From 596a3eaf08f7cadbe72f64e5a98eeff1543df1d7 Mon Sep 17 00:00:00 2001 From: MadeTech Dushan Date: Wed, 10 Nov 2021 11:36:01 +0000 Subject: [PATCH] pass first reset confirmation test --- app/controllers/users/passwords_controller.rb | 12 ++++++++++++ app/views/devise/confirmations/reset.html.erb | 8 ++++++++ .../mailer/reset_password_instructions.html.erb | 2 -- config/routes.rb | 6 +++++- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 app/controllers/users/passwords_controller.rb create mode 100644 app/views/devise/confirmations/reset.html.erb diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb new file mode 100644 index 000000000..09703031c --- /dev/null +++ b/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 \ No newline at end of file diff --git a/app/views/devise/confirmations/reset.html.erb b/app/views/devise/confirmations/reset.html.erb new file mode 100644 index 000000000..a70254cf4 --- /dev/null +++ b/app/views/devise/confirmations/reset.html.erb @@ -0,0 +1,8 @@ +
+
+

Check your email

+

We’ve sent a link to reset your password to name@example.com.

+

You’ll only this receive this link if your email address already exists in our system.

+

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.

+
+
\ No newline at end of file diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb index f667dc12f..45034dc1d 100644 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -2,7 +2,5 @@

Someone has requested a link to change your password. You can do this through the link below.

-

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

-

If you didn't request this, please ignore this email.

Your password won't change until you access the link above and create a new one.

diff --git a/config/routes.rb b/config/routes.rb index 06dc569b5..0440e9743 100644 --- a/config/routes.rb +++ b/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"