How to redirect the user to login page after sending password reset instructions in rails 3 using devise

Anirudh Rautela

I am using devise for authentication in Rails 3. I was able to redirect the user after signing in to the home page by creating a file named custom_failure.rb inside lib folder of my app and adding some code in application.rb. Following is my custom_failure.rb code

class CustomFailure < Devise::FailureApp

 def redirect_url
  root_path
 end

 def respond
  if http_auth?
   http_auth
  else
   redirect
  end
 end

end

Following is the application.rb code

config.autoload_paths += %W(#{config.root}/lib)

Please help me out by specifying which redirect function should I override in order to redirect the user to login page after the reset password mail is sent.Thanks

swapab

As suggested - https://stackoverflow.com/a/19402686/1125893 You can override after_sending_reset_password_instructions_path_for(resource_name) in Devise::PasswordController

def after_sending_reset_password_instructions_path_for(resource_name)
  root_path
end

https://github.com/plataformatec/devise/wiki/How-To:-Redirect-URL-after-sending-reset-password-instructions

#routes.rb
devise_for :users, :controllers => { :passwords => "passwords" }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Redirect after sending reset password instruction devise

From Dev

Redirect to Login page after successful reset password

From Dev

Send reset_password_instructions manually with devise 3.1.1 rails

From Dev

How to sign in the user after redirect through devise in Rails?

From Dev

Rails devise reset password fails if user record contains invalid data

From Dev

Redirect after sending password reset link in Laravel 5.1?

From Dev

How to redirect a user with specific "ROLE" to a specific page after login in Wordpress

From Dev

How to redirect a user with specific "ROLE" to a specific page after login in Wordpress

From Dev

How to redirect user after login to a desired page according to their role?

From Dev

Symfony - How to redirect the user to last page visited after login?

From Dev

Devise with Ruby on Rails - Force user to change password on first login

From Dev

After signup redirect user to login page

From Dev

redirect user to a a page after he login

From Dev

Devise After first login redirect

From Dev

Rails 4.0 Devise - Polymorphic - redirect to user after signup

From Dev

Rails 4.0 Devise - Polymorphic - redirect to user after signup

From Dev

Page For Entering One-time-password Does Not Appear After Sending OTP to User Using PHP

From Dev

Redirect to Reports page after login using Session

From Dev

redirect to requested page after login using spring

From Dev

Codeigniter login system with session to redirect user to page if password correct

From Dev

Flask-Login: login user and redirect to home page after registration

From Dev

How to send an admin specific password reset email to admins using Devise?

From Dev

In Rails when using the Devise gem how to create a user without email and password?

From Dev

In Rails when using the Devise gem how to create a user without email and password?

From Dev

Login and password script with each user having a custom page after login

From Dev

How to redirect a user to login page in mvc

From Dev

How do I keep the user signed in after they update their password using Devise?

From Dev

Devise get user by reset_password_token

From Dev

Redirect a user after registration when using Devise doesn't work?

Related Related

  1. 1

    Redirect after sending reset password instruction devise

  2. 2

    Redirect to Login page after successful reset password

  3. 3

    Send reset_password_instructions manually with devise 3.1.1 rails

  4. 4

    How to sign in the user after redirect through devise in Rails?

  5. 5

    Rails devise reset password fails if user record contains invalid data

  6. 6

    Redirect after sending password reset link in Laravel 5.1?

  7. 7

    How to redirect a user with specific "ROLE" to a specific page after login in Wordpress

  8. 8

    How to redirect a user with specific "ROLE" to a specific page after login in Wordpress

  9. 9

    How to redirect user after login to a desired page according to their role?

  10. 10

    Symfony - How to redirect the user to last page visited after login?

  11. 11

    Devise with Ruby on Rails - Force user to change password on first login

  12. 12

    After signup redirect user to login page

  13. 13

    redirect user to a a page after he login

  14. 14

    Devise After first login redirect

  15. 15

    Rails 4.0 Devise - Polymorphic - redirect to user after signup

  16. 16

    Rails 4.0 Devise - Polymorphic - redirect to user after signup

  17. 17

    Page For Entering One-time-password Does Not Appear After Sending OTP to User Using PHP

  18. 18

    Redirect to Reports page after login using Session

  19. 19

    redirect to requested page after login using spring

  20. 20

    Codeigniter login system with session to redirect user to page if password correct

  21. 21

    Flask-Login: login user and redirect to home page after registration

  22. 22

    How to send an admin specific password reset email to admins using Devise?

  23. 23

    In Rails when using the Devise gem how to create a user without email and password?

  24. 24

    In Rails when using the Devise gem how to create a user without email and password?

  25. 25

    Login and password script with each user having a custom page after login

  26. 26

    How to redirect a user to login page in mvc

  27. 27

    How do I keep the user signed in after they update their password using Devise?

  28. 28

    Devise get user by reset_password_token

  29. 29

    Redirect a user after registration when using Devise doesn't work?

HotTag

Archive