diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 806315ca8..a83c7e75b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -220,6 +220,8 @@ class UsersController < ApplicationController authentication.finish activation.finish + # save user email in session, to show on account-created page + session["user_created_email"] = user.email render json: { success: true, diff --git a/app/views/users/account_created.html.erb b/app/views/users/account_created.html.erb index ce13d4f14..ea8cf7d9e 100644 --- a/app/views/users/account_created.html.erb +++ b/app/views/users/account_created.html.erb @@ -1,3 +1,5 @@
You're almost done! We sent an activation mail to %{email}. Please follow the instructions in the email to activate your account.
If it doesn't arrive, check your spam folder, or try to log in again to send another activation mail.
" not_activated: "You can't log in yet. We sent an activation email to you. Please follow the instructions in the email to activate your account." not_allowed_from_ip_address: "You can't login as %{username} from that IP address." suspended: "You can't log in until %{date}." diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 6ba162515..1b12ac2e7 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -356,6 +356,9 @@ describe UsersController do post_user expect(JSON.parse(response.body)['active']).to be_falsey + + # should save user_created_email in session + session["user_created_email"].should == @user.email end context "and 'must approve users' site setting is enabled" do @@ -389,6 +392,9 @@ describe UsersController do it 'enqueues a welcome email' do User.any_instance.expects(:enqueue_welcome_message).with('welcome_user') post_user + + # should save user_created_email in session + session["user_created_email"].should == @user.email end it "shows the 'active' message" do @@ -471,6 +477,9 @@ describe UsersController do xhr :post, :create, create_params json = JSON::parse(response.body) json["success"].should == true + + # should not change the session + session["user_created_email"].should be_blank end end @@ -512,6 +521,9 @@ describe UsersController do xhr :post, :create, create_params json = JSON::parse(response.body) json["success"].should_not == true + + # should not change the session + session["user_created_email"].should be_blank end end