diff --git a/app/controllers/spree/admin/users_controller.rb b/app/controllers/spree/admin/users_controller.rb index 17ab1d041d..d941785f01 100644 --- a/app/controllers/spree/admin/users_controller.rb +++ b/app/controllers/spree/admin/users_controller.rb @@ -46,7 +46,12 @@ module Spree @user.spree_roles = roles.reject(&:blank?).collect{ |r| Spree::Role.find(r) } end - flash.now[:success] = Spree.t(:account_updated) + message = if new_email_unconfirmed? + Spree.t(:email_updated) + else + Spree.t(:account_updated) + end + flash.now[:success] = message end render :edit end @@ -126,6 +131,10 @@ module Spree def load_roles @roles = Spree::Role.scoped end + + def new_email_unconfirmed? + params[:user][:email] != @user.email + end end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 9348cd9138..b595cb9da0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2943,6 +2943,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using email: Email # TODO: remove 'account_updated' key once we get to Spree 2.0 account_updated: "Account updated!" + email_updated: "The account will be updated once the new email is confirmed." my_account: "My account" date: "Date" time: "Time" diff --git a/spec/features/admin/users_spec.rb b/spec/features/admin/users_spec.rb index d58ba686a6..4ab504c5a4 100644 --- a/spec/features/admin/users_spec.rb +++ b/spec/features/admin/users_spec.rb @@ -64,6 +64,13 @@ feature "Managing users" do expect(page).to have_content("Account updated") end + + it "should let me edit the user email" do + fill_in "Email", with: "newemail@example.org" + click_button "Update" + + expect(page).to have_content("The account will be updated once the new email is confirmed.") + end end end