before_action :check_database_readable
before_action :check_database_writable, :only => [:update]
- before_action :allow_thirdparty_images, :only => [:edit, :update]
- def edit
- @tokens = current_user.oauth_tokens.authorized
-
- append_content_security_policy_directives(
- :form_action => %w[accounts.google.com *.facebook.com login.live.com login.microsoftonline.com github.com meta.wikimedia.org]
- )
+ allow_thirdparty_images :only => [:show, :update]
+ allow_social_login :only => [:show, :update]
+ def show
if errors = session.delete(:user_errors)
errors.each do |attribute, error|
current_user.errors.add(attribute, error)
end
def update
- @tokens = current_user.oauth_tokens.authorized
-
- append_content_security_policy_directives(
- :form_action => %w[accounts.google.com *.facebook.com login.live.com login.microsoftonline.com github.com meta.wikimedia.org]
- )
-
user_params = params.require(:user).permit(:display_name, :new_email, :pass_crypt, :pass_crypt_confirmation, :auth_provider)
if params[:user][:auth_provider].blank? ||
(params[:user][:auth_provider] == current_user.auth_provider &&
params[:user][:auth_uid] == current_user.auth_uid)
update_user(current_user, user_params)
- if current_user.errors.count.zero?
- redirect_to edit_account_path
+ if current_user.errors.empty?
+ redirect_to account_path
else
- render :edit
+ render :show
end
else
session[:new_user_settings] = user_params.to_h