Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing the devise edit password screen

In my rails 3 app using devise, I want to provide a link for users to edit their password.

I have a standard link that points to: /users/password/edit ... Log output below

Started GET "/users/password/edit" for 127.0.0.1 at 2011-08-10 10:11:46 -0700
  Processing by Devise::PasswordsController#edit as HTML
  User Load (0.6ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 3 LIMIT 1
Redirected to http://localhost:3000/
Completed 302 Found in 309ms

Why is rails redirecting? Why can't I show the edit password page? Thanks

like image 789
AnApprentice Avatar asked Aug 10 '11 17:08

AnApprentice


1 Answers

Devise::PasswordsController#edit is for non-authenticated users who wish to change their password using a reset token. This reset token was previously sent to the user in an email (Reset password instructions). If the user is already logged in, this edit password page will always redirect to the after-sign-in path since it shouldn't be accessible to authenticated users.

I suppose what you want is to allow the user to change his password after logging in. You have to use Devise::RegistrationsController#edit for that.

like image 147
M. Cypher Avatar answered Oct 11 '22 19:10

M. Cypher