CppNoob
CppNoob

Reputation: 2390

Rails: Use a custom URL for password reset with Devise

I am using Devise for authentication in my Rails app. The password management including reset password mailers, etc. is handled via a controller that derives from Devise::PasswordsController. Something like:

class Users::PasswordsController < Devise::PasswordsController
  def new
    if not set_actionmailer_settings
      error = I18n.t('invalid_paswd_config')
      redirect_to new_user_session_path, 
                  :flash => { :error => error } and return
    end

    super
  end
end

I have now moved to a new UI that does not use Rails UI. Instead it calls into the Rails APIs. In the email that is sent to the user for resetting password, if I want to use a use a custom password reset URL, how do I do it?

Upvotes: 2

Views: 352

Answers (1)

Md. Farhan Memon
Md. Farhan Memon

Reputation: 6121

try this in your routes.rb

map.devise_for :users, controllers: {passwords: "users/passwords"}, path_names: {
  new: :new
}

Upvotes: 1

Related Questions