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 @tokens = current_user.oauth_tokens.authorized
21 if errors = session.delete(:user_errors)
22 errors.each do |attribute, error|
23 current_user.errors.add(attribute, error)
30 @tokens = current_user.oauth_tokens.authorized
32 user_params = params.require(:user).permit(:display_name, :new_email, :pass_crypt, :pass_crypt_confirmation, :auth_provider)
34 if params[:user][:auth_provider].blank? ||
35 (params[:user][:auth_provider] == current_user.auth_provider &&
36 params[:user][:auth_uid] == current_user.auth_uid)
37 update_user(current_user, user_params)
38 if current_user.errors.count.zero?
39 redirect_to edit_account_path
44 session[:new_user_settings] = user_params.to_h
45 redirect_to auth_url(params[:user][:auth_provider], params[:user][:auth_uid]), :status => :temporary_redirect
50 if current_user.deletion_allowed?
51 current_user.soft_destroy!
54 session_expires_automatically
56 flash[:notice] = t ".success"