Browse Source

Merge d79ec2aca1 into 4af4c948e9

pull/3089/merge
Samuel Young 3 days ago committed by GitHub
parent
commit
d14f1071ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      app/controllers/auth/passwords_controller.rb
  2. 8
      app/models/user.rb
  3. 4
      app/views/devise/passwords/reset_resend_confirmation.html.erb

5
app/controllers/auth/passwords_controller.rb

@ -4,6 +4,7 @@ class Auth::PasswordsController < Devise::PasswordsController
def reset_confirmation
self.resource = resource_class.new
@email = params["email"]
@unconfirmed = params["unconfirmed"] == "true"
if @email.blank?
resource.errors.add :email, I18n.t("validations.email.blank")
render "devise/passwords/new", status: :unprocessable_entity
@ -65,8 +66,8 @@ protected
resource.need_two_factor_authentication?(request) ? :updated_2FA : :updated
end
def after_sending_reset_password_instructions_path_for(_resource)
account_password_reset_confirmation_path(email: params.dig("user", "email"))
def after_sending_reset_password_instructions_path_for(_resource_name)
account_password_reset_confirmation_path(email: params.dig("user", "email"), unconfirmed: resource.initial_confirmation_sent && !resource.confirmed?)
end
def after_resetting_password_path_for(resource)

8
app/models/user.rb

@ -358,6 +358,14 @@ class User < ApplicationRecord
end
end
def send_reset_password_instructions
if confirmed?
super
else
send_confirmation_instructions
end
end
protected
# Checks whether a password is needed or not. For validations only.

4
app/views/devise/passwords/reset_resend_confirmation.html.erb

@ -6,7 +6,11 @@
<%= content_for(:title) %>
</h1>
<% if @unconfirmed %>
<p class="govuk-body">We’ve sent a link to confirm your email address to <strong><%= @email %></strong>. This will complete your registration onto the CORE service.</p>
<% else %>
<p class="govuk-body">We’ve sent a link to reset your password to <strong><%= @email %></strong>.</p>
<% end %>
<p class="govuk-body">You’ll only receive this link if your email address already exists in our system.</p>
<p class="govuk-body">If you don’t receive the email within 5 minutes, check your spam or junk folders. Try again if you still haven’t received the email.</p>
</div>

Loading…
Cancel
Save