add user email on account created page

This commit is contained in:
Arpit Jalan 2014-10-01 23:03:49 +05:30
parent be93f224a6
commit 41af2d79b5
4 changed files with 18 additions and 2 deletions

View file

@ -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,

View file

@ -1,3 +1,5 @@
<div id='simple-container'>
<span style="font-size: 16px; line-height: 24px;"><%= t 'login.activate_email' %></span>
<% if session["user_created_email"] %>
<span style="font-size: 16px; line-height: 24px;"><%= t('login.activate_email', email: session["user_created_email"]).html_safe %></span>
<% end %>
</div>

View file

@ -1087,7 +1087,7 @@ en:
incorrect_username_email_or_password: "Incorrect username, email or password"
wait_approval: "Thanks for signing up. We will notify you when your account has been approved."
active: "Your account is activated and ready to use."
activate_email: "You're almost done! We sent an activation mail to the email address you provided. Please follow the instructions in the email to activate your account."
activate_email: "<p>You're almost done! We sent an activation mail to <b>%{email}</b>. Please follow the instructions in the email to activate your account.</p><p>If it doesn't arrive, check your spam folder, or try to log in again to send another activation mail.</p>"
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}."

View file

@ -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