plataformatec/devise — Issue #1561: Cannot override Devise passwords controller
Author: abhijeetmisra
Created: 2012-01-11 08:54:08+00:00
State: open

I need my app to redirect to the home page after I submit the email to send me reset password instructions. Devise, by default renders the signin form after entering the email.

So I am trying to override the Devise::PasswordsController and change its redirect_to, but no success. Infact, I don't think rails is even taking in my class. I could be a very stupid mistake but I have been at it for half a day with no success.

I took the idea to override Passwords controller from here : https://github.com/plataformatec/devise/pull/1067

Here's my controller:

class PasswordsController < Devise::PasswordsController
protected
def after_sending_reset_password_instructions_path_for(resource_name)
root_url
end
end

Routes.rb:

devise_for :users, :controllers => {:passwords => "passwords"}
devise_for :users, :controllers => {:registrations => "registrations"}
devise_for :users, :controllers => {:sessions => "sessions"}

I would like to mention that I have overridden Devise's Registations and Sessions Controllers in the same app, and they seem to work fine.

Please help.