开发者

Devise edit_account_password action redirects me to the root

Here are my devise routes:

devise_for :accounts, :path_names => { :sign_up => "new" } do
  get "sign_in",           :to => "devise/sessions#new"
  get "sign_out",          :to => "devise/sessions#destroy"
  get "/change_password",  :to => "devise/passwords#edit"
end

And the output of my rake routes:

       account_password POST   /accounts/password(.:format)           开发者_运维百科     {:controller=>"devise/passwords", :action=>"create"}
   new_account_password GET    /accounts/password/new(.:format)            {:controller=>"devise/passwords", :action=>"new"}
  edit_account_password GET    /accounts/password/edit(.:format)           {:controller=>"devise/passwords", :action=>"edit"}
                        PUT    /accounts/password(.:format)                {:controller=>"devise/passwords", :action=>"update"}

So the change_password route is not in place and /change_password just redirects me to the root_path. Please help me understand why or I will hurt myself. Thank you.


Okay, im figured out the problem. Edit password is from Recoverable module, it aims to help the user to get his/her password back if its forgotten, and not for a signed in user to change his/her password. You can use registration/edit instead.


I wasn't sure if you were talking about behavior after a user changes his password through the above-mentioned routed change password action. If you are, please consider this question and answer which may either answer your question or give you a heads up for what you may encounter:

Devise logging out automatically after password change

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜