设计:如果已经登录,不要在密码重置时重定向 [英] Devise: Don't redirect on password reset if already logged in
问题描述
如果用户已经登录并单击其电子邮件中的密码重置链接,他们将自动重定向到登录区域。我希望用户能够重置其密码(是否登录)。如何防止重定向?
If a user is already logged in and clicks on a password reset link from their email, they automatically get redirected to the logged in area. I want the user to be able to reset their password, logged in or not. How do I prevent the redirect?
推荐答案
您要尝试执行的操作是使用Devise recoverable
模块更改登录的用户密码。这不是可恢复
模块的目的。
What you are trying to do is, use Devise recoverable
module to change a logged in user password. This is not what recoverable
module was built for.
根据设计协作者 carlosantoniodasilva
此功能用于恢复密码,不适用于已登录用户
更改密码。如果需要,可以使用Registerable
模块或自己处理。
This feature is for recovering passwords, not for signed in users change their passwords. If you want that, you can use Registerable module or handle it by yourself.
Registerable
模块处理通过注册过程对用户进行注册,还允许他们编辑和销毁其帐户。
Registerable
module handles signing up users through a registration process, also allowing them to edit and destroy their account.
这篇关于设计:如果已经登录,不要在密码重置时重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!