Skip to content
Merged
1 change: 1 addition & 0 deletions app/assets/images/letter-warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def reset_password_instructions(user, email, token:)
with_user_locale(user) do
@locale = locale_url_param
@token = token
@pending_profile_requires_verification = user.decorate.pending_profile_requires_verification?
@hide_title = @pending_profile_requires_verification
mail(to: email, subject: t('user_mailer.reset_password_instructions.subject'))
end
end
Expand Down
18 changes: 18 additions & 0 deletions app/views/user_mailer/reset_password_instructions.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
<% if @pending_profile_requires_verification %>
<table>
<tbody>
<tr>
<td width="140">
<%= image_tag('letter-warning.svg', width: 140, height: 140, alt: '') %>
</td>
<td class="padding-left-3">
<h2 style="font-size:22px;"><%= t('user_mailer.reset_password_instructions.gpo_letter_header') %></h2>
<p><%= t('user_mailer.reset_password_instructions.gpo_letter_description') %></p>
</td>
</tr>
</table>
<hr class="border-0 border-bottom border-primary-light margin-y-4" />
<h1>
<%= @header || message.subject %>
</h1>
<% end %>
<p class="lead">
<%= t(
'user_mailer.reset_password_instructions.header',
Expand Down
4 changes: 4 additions & 0 deletions config/locales/user_mailer/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ en:
subject: Unusual activity — reset your %{app_name} password
reset_password_instructions:
footer: This link expires in %{expires} hours.
gpo_letter_description: If you reset your password, the confirmation code in
your letter will no longer work and you’ll have to verify your identity
again.
gpo_letter_header: Your letter is on the way
header: To finish resetting your password, please click the link below or copy
and paste the entire link into your browser.
link_text: Reset your password
Expand Down
4 changes: 4 additions & 0 deletions config/locales/user_mailer/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ es:
subject: Actividad inusual — restablezca su contraseña de %{app_name}
reset_password_instructions:
footer: Este enlace expira en %{expires} horas.
gpo_letter_description: Si restablece su contraseña, el código de confirmación
que figura en su carta dejará de funcionar y tendrá que volver a
verificar su identidad.
gpo_letter_header: Su carta está en camino
header: Para terminar de restablecer su contraseña, haga clic en el enlace de
abajo o copie y pegue el enlace completo en su navegador.
link_text: Restablezca su contraseña
Expand Down
4 changes: 4 additions & 0 deletions config/locales/user_mailer/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ fr:
subject: Activité inhabituelle — réinitialisez votre mot de passe %{app_name}
reset_password_instructions:
footer: Ce lien expire dans %{expires} heures.
gpo_letter_description: Si vous réinitialisez votre mot de passe, le code de
confirmation contenu dans votre lettre ne correspondra plus et vous
devrez de vérifier à nouveau votre identité.
gpo_letter_header: Votre lettre est en route
header: Pour terminer la réinitialisation de votre mot de passe, veuillez
cliquer sur le lien ci-dessous ou copier et coller le lien complet dans
votre navigateur.
Expand Down
33 changes: 33 additions & 0 deletions spec/features/users/password_reset_with_pending_profile_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'rails_helper'

feature 'reset password with pending profile' do
include PersonalKeyHelper

let(:user) { create(:user, :signed_up) }

scenario 'password reset email includes warning for pending profile' do
profile = create(
:profile,
deactivation_reason: :gpo_verification_pending,
pii: { ssn: '666-66-1234', dob: '1920-01-01', phone: '+1 703-555-9999' },
user: user,
)
create(:gpo_confirmation_code, profile: profile)

trigger_reset_password_and_click_email_link(user.email)

html_body = ActionMailer::Base.deliveries.last.html_part.body.decoded
expect(html_body).to include(
t('user_mailer.reset_password_instructions.gpo_letter_description'),
)
end

scenario 'password reset email does not include warning without pending profile' do
trigger_reset_password_and_click_email_link(user.email)

html_body = ActionMailer::Base.deliveries.last.html_part.body.decoded
expect(html_body).to_not include(
t('user_mailer.reset_password_instructions.gpo_letter_description'),
)
end
end