Skip to content

Commit

Permalink
Merge pull request #3948 from kiranbpatil/3571-update-invite-pwd-rese…
Browse files Browse the repository at this point in the history
…t-emails

3571 - Update invitation & password reset email text
  • Loading branch information
awwaiid authored Dec 17, 2023
2 parents 8610d17 + d3a31af commit 9507d50
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ PLATFORMS
arm64-darwin-20
arm64-darwin-21
arm64-darwin-22
arm64-darwin-23
x86_64-darwin-20
x86_64-darwin-21
x86_64-darwin-22
Expand Down
2 changes: 2 additions & 0 deletions app/views/users/mailer/invitation_instructions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@
<% if @resource.invitation_due_at %>
<p><%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %></p>
<% end %>
<p>For security reasons these invitations expire. This invitation will expire in 8 hours or if a new password reset is triggered.</p>
<p>If your invitation has an expired message, go <%= link_to "here", new_user_password_url %> and enter your email address to reset your password.</p>
<p>Feel free to ignore this email if you are not interested or if you feel it was sent by mistake.</p>
</td>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions app/views/users/mailer/reset_password_instructions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@

<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>

<p>For security reasons these invitations expire. This invitation will expire in 8 hours or if a new password reset is triggered.</p>
<p>If your invitation has an expired message, go <%= link_to "here", new_user_password_url %> and enter your email address to reset your password.</p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
4 changes: 4 additions & 0 deletions spec/mailers/custom_devise_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
expect(mail.subject).to eq("Your Human Essentials App Account Approval")
expect(mail.html_part.body).to include("Your request has been approved and you're invited to become an user of the Human Essentials inventory management system!")
end

it "has invite expiration message" do
expect(mail.html_part.body).to include("For security reasons these invitations expire. This invitation will expire in 8 hours or if a new password reset is triggered.")
end
end
end
end
16 changes: 16 additions & 0 deletions spec/mailers/user_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,20 @@
expect(mail.subject).to eq("Role Added")
end
end

describe "#send_reset_password_instructions" do
context "user gets an email with instructions" do
let(:user) { create(:user) }

before(:each) do
user.send_reset_password_instructions
end

let(:mail) { ActionMailer::Base.deliveries.last }

it "sends an email with instructions" do
expect(mail.body.encoded).to include("For security reasons these invitations expire. This invitation will expire in 8 hours or if a new password reset is triggered.")
end
end
end
end

0 comments on commit 9507d50

Please sign in to comment.