Back to Devise Wiki

How To: Redirect URL After Sending Reset Password Instructions

How-To:-Redirect-URL-after-sending-reset-password-instructions.md

latest982 B
Original Source

Source: http://stackoverflow.com/questions/8809681/cannot-override-devise-passwords-controller

Look at the source code for devise's PasswordsController:

ruby
respond_with resource, location: after_resetting_password_path_for(resource)

You'll have to create a PasswordsController in your app that inherits from Devise::PasswordsController, implement only the after_sending_reset_password_instructions_path_for(resource_name) method and when setting the routes tell devise to use your controller.

ruby
class PasswordsController < Devise::PasswordsController
  protected
  def after_sending_reset_password_instructions_path_for(resource_name)
    #return your path
  end
end

Remember to update your routes.rb-file to use this custom controller:

ruby
devise_for :users, controllers: { passwords: 'passwords' }