When email change fails, give appropriate error message
Previously it would always say "Password was incorrect" on failure, whether that was the actual problem or not.
This commit is contained in:
@@ -6,11 +6,12 @@ module Maintenance
|
||||
|
||||
def create
|
||||
email_change = UserEmailChange.new(CurrentUser.user, params[:email_change][:email], params[:email_change][:password])
|
||||
if email_change.process
|
||||
redirect_to(edit_user_path(CurrentUser.user.id), :notice => "Email was updated")
|
||||
email_change.process
|
||||
if CurrentUser.user.errors.any?
|
||||
flash[:notice] = CurrentUser.user.errors.full_messages.join("; ")
|
||||
redirect_to(new_maintenance_user_email_change_path)
|
||||
else
|
||||
flash[:notice] = "Password was incorrect"
|
||||
render :action => "new"
|
||||
redirect_to(edit_user_path(CurrentUser.user.id), :notice => "Email was updated")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user