Reputation: 54949
I have devise set up in my application and when i try to reset my password it generates these two URLs out of which only the first one works fine.
http://<domain>/password/edit?reset_password_token=SawsfhnpFRPHsxj_HjRhJ <--- works
http://<domain>/users/password/edit?reset_password_token=o1x1wFjQZxWnAug7K1zo
Any way to make sure it generates the right URL when a user wants to reset the password?
Routes
# Devise Authentication
devise_for :users, :controllers => { :registrations => "registrations", :sessions => "sessions" },
:path => "",
:path_names => { :sign_in => 'login',
:sign_out => 'logout',
:sign_up => 'signup',
:edit => 'profile/edit' }
devise_scope :user do
match '/update_password' => 'registrations#update_password', via: :post
end
app/views/users/mailer/reset_password_instructions.html.erb
<p><%= link_to 'Click here', edit_password_url(@resource, reset_password_token: @token) %> to reset your password</p>
When i rake routes
i am not finding the above routes.
Found these routes
user_password POST /password(.:format) devise/passwords#create
new_user_password GET /password/new(.:format) devise/passwords#new
edit_user_password GET /password/edit(.:format) devise/passwords#edit
PATCH /password(.:format) devise/passwords#update
PUT /password(.:format) devise/passwords#update
Upvotes: 0
Views: 360
Reputation: 457
Keep it inside the devise_for scope
devise_for :users, :controllers => { :registrations => "registrations", :sessions => "sessions" },
:path => "",
:path_names => { :sign_in => 'login',
:sign_out => 'logout',
:sign_up => 'signup',
:edit => 'profile/edit' } do
match '/update_password' => 'users/registrations#update_password', via: :post
end
Upvotes: 1