ruby-on-railsdeviseruby-on-rails-5devise-confirmable

How to prevent automatic signin after confirmation and setting password using devise


I need to create user using email and then send a confirmation link to email after comfirming he will be redirected to password edit page where he will set the password. When we change the password and submit it the the user is getting signed in automatically which i want to to prevent. Can any one tell me how to do it

I am using latest devise rails and ruby versions and i have gone through various stack overflow questions regarding the same but dint find a solution


Solution

  • Change your config/initializers/devise.rb

    you'll see...

      # When set to false, does not sign a user in automatically after their password is
      # reset. Defaults to true, so a user is signed in automatically after a reset.
      # config.sign_in_after_reset_password = true
    

    Uncomment and change the last line to

      config.sign_in_after_reset_password = false