设计在重置密码之前注销用户



我希望当用户点击"重置我的密码"链接在电子邮件中,如果他们已登录,则在呈现密码重置表单之前将其注销。现在它会弹出一个提示框"您已经登录了"我希望这是一个配置或一个常见的模式。

谢谢你的帮助,凯文

我想出了这个解决方案,在我的密码控制器中,我添加了这个:

def require_no_authentication
# this is a polymorphic override of devise controller, this is where they check
# for if a user is already signed in, if they are editing their password then
# sign them out before taking them to the password reset
if params[:action] == "edit" and current_user
sign_out(current_user)
end
super    
end

最新更新