1 class AccountsController < ApplicationController
7 before_action :authorize_web
8 before_action :set_locale
10 authorize_resource :class => false
12 before_action :check_database_readable
13 before_action :check_database_writable, :only => [:update]
15 allow_thirdparty_images :only => [:edit, :update]
16 allow_social_login :only => [:edit, :update]
19 if errors = session.delete(:user_errors)
20 errors.each do |attribute, error|
21 current_user.errors.add(attribute, error)
28 user_params = params.require(:user).permit(:display_name, :new_email, :pass_crypt, :pass_crypt_confirmation, :auth_provider)
30 if params[:user][:auth_provider].blank? ||
31 (params[:user][:auth_provider] == current_user.auth_provider &&
32 params[:user][:auth_uid] == current_user.auth_uid)
33 update_user(current_user, user_params)
34 if current_user.errors.count.zero?
35 redirect_to edit_account_path
40 session[:new_user_settings] = user_params.to_h
41 redirect_to auth_url(params[:user][:auth_provider], params[:user][:auth_uid]), :status => :temporary_redirect
46 if current_user.deletion_allowed?
47 current_user.soft_destroy!
50 session_expires_automatically
52 flash[:notice] = t ".success"