Add clarification when updating user's email
This commit is contained in:
parent
5b78666eb8
commit
2b749fb1c5
1 changed files with 8 additions and 1 deletions
|
|
@ -20,8 +20,15 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
message = ''
|
||||||
|
if params[:user] && !params[:user][:email].nil?
|
||||||
|
if (new_email = params[:user][:email]) != @user.email
|
||||||
|
message = " Confirmation email sent to #{new_email}. The new email needs to be confirmed before it can be used."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if @user.update_attributes(params[:user])
|
if @user.update_attributes(params[:user])
|
||||||
redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!"
|
redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!" + message
|
||||||
else
|
else
|
||||||
redirect_to admin_users_path, alert: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}."
|
redirect_to admin_users_path, alert: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}."
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue