@current_user -> current_user

This commit is contained in:
simon lehericey 2019-12-09 16:50:30 +01:00
parent e06733d01b
commit 21910c959e

View file

@ -10,14 +10,14 @@ module Users
end end
def update_email def update_email
if @current_user.update(update_email_params) if current_user.update(update_email_params)
flash.notice = t('devise.registrations.update_needs_confirmation') flash.notice = t('devise.registrations.update_needs_confirmation')
elsif @current_user.errors&.details&.dig(:email)&.any? { |e| e[:error] == :taken } elsif current_user.errors&.details&.dig(:email)&.any? { |e| e[:error] == :taken }
UserMailer.account_already_taken(@current_user, requested_email).deliver_later UserMailer.account_already_taken(current_user, requested_email).deliver_later
# avoid leaking information about whether an account with this email exists or not # avoid leaking information about whether an account with this email exists or not
flash.notice = t('devise.registrations.update_needs_confirmation') flash.notice = t('devise.registrations.update_needs_confirmation')
else else
flash.alert = @current_user.errors.full_messages flash.alert = current_user.errors.full_messages
end end
redirect_to profil_path redirect_to profil_path