Browse Source

pass first reset confirmation test

pull/81/head
MadeTech Dushan 3 years ago
parent
commit
596a3eaf08
  1. 12
      app/controllers/users/passwords_controller.rb
  2. 8
      app/views/devise/confirmations/reset.html.erb
  3. 2
      app/views/devise/mailer/reset_password_instructions.html.erb
  4. 6
      config/routes.rb

12
app/controllers/users/passwords_controller.rb

@ -0,0 +1,12 @@
class Users::PasswordsController < Devise::PasswordsController
def reset_confirmation
render "devise/confirmations/reset"
end
protected
def after_sending_reset_password_instructions_path_for(resource)
confirmations_reset_path if is_navigational_format?
end
end

8
app/views/devise/confirmations/reset.html.erb

@ -0,0 +1,8 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l"> Check your email</h1>
<p class="govuk-body">We’ve sent a link to reset your password to <strong>name@example.com</strong>.</p>
<p class="govuk-body">You’ll only this 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>
</div>

2
app/views/devise/mailer/reset_password_instructions.html.erb

@ -2,7 +2,5 @@
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></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>

6
config/routes.rb

@ -1,5 +1,9 @@
Rails.application.routes.draw do
devise_for :users
devise_for :users, controllers: { passwords: "users/passwords" }
devise_scope :user do
get "confirmations/reset", to: "users/passwords#reset_confirmation"
end
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
ActiveAdmin.routes(self)
root to: "test#index"

Loading…
Cancel
Save