Skip to content

Commit

Permalink
Add link text to change password mail template
Browse files Browse the repository at this point in the history
Included a default fallback to provide a base English translation for
users that are using a locale file that does not define this new key.
  • Loading branch information
farukaydin authored and derekprior committed Apr 3, 2015
1 parent 0181691 commit 41f06be
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/views/clearance_mailer/change_password.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<%= t(".opening") %>
<p><%= t(".opening") %></p>

<%= edit_user_password_url(@user, token: @user.confirmation_token.html_safe) %>
<p>
<%= link_to t(".link_text", default: "Change my password"),
edit_user_password_url(@user, token: @user.confirmation_token.html_safe) %>
</p>

<%= raw t(".closing") %>
<p><%= raw t(".closing") %></p>
1 change: 1 addition & 0 deletions config/locales/clearance.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ en:
change_password:
closing: If you didn't request this, ignore this email. Your password has
not been changed.
link_text: Change my password
opening: "Someone, hopefully you, requested we send you a link to change
your password:"
flashes:
Expand Down
3 changes: 3 additions & 0 deletions spec/mailers/clearance_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
email = ClearanceMailer.change_password(user)

expect(email.body.to_s).to include(link)
expect(email.body.to_s).to have_css(
"a", text: I18n.t("clearance_mailer.change_password.link_text")
)
end

it "sets its subject" do
Expand Down

0 comments on commit 41f06be

Please sign in to comment.