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 => [:show, :update]
16 allow_social_login :only => [:show, :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.expect(:user => [: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 update_user(current_user, user_params)
33 if current_user.errors.empty?
34 redirect_to account_path
39 session[:new_user_settings] = user_params.to_h
40 redirect_to auth_url(params[:user][:auth_provider]), :status => :temporary_redirect
45 if current_user.deletion_allowed?
46 current_user.soft_destroy!
49 session_expires_automatically
51 flash[:notice] = t ".success"