I want to add a feature to my app in which when a user is signed in he can change his password just by clicking on change password link.But when I click on that link it redirects to the current page.
<%= link_to 'Change password', edit_user_password_path %>
Can someone tell me what to do to solve this problem?
Because I can't write a comment (my reputation is too low) I'll write an answer instead.
Take a look here:
rails devise edit_user_password_path
This should solve your problem.
In short: The Devise PasswordsController can only be used if a user is signed_out.
Assuming user is loged in and want to change his password
Devise::RegistrationsController#edit
Your link would like:
<%= link_to 'Change password', edit_user_registration_path(current_user) %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.