什么情况会导致 Devise 退出?
当我第一次从 Restful Authentication 迁移到 Devise 时,Destroy 方法导致 Devise 由于缺少 CSRF 令牌而注销。我记得读过,如果 Devise 无法执行某些操作(例如可能访问某个方法),则它会注销,但我不确定到底是什么导致它注销。 哪些可能性可能导致 Devise 退出?
When I first migrated from Restful Authentication to Devise the Destroy methods caused Devise to sign out because of a missing CSRF token that was missing. I remember reading that Devise signs out if it can't do something (like maybe access a method), but I am unsure what exactly causes it to sign out.
What are possibilities that could cause Devise to sign out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
导致其注销的一种情况是表单输入值之一缺少authenticity_token。这发生在我身上,因为我在 Kompozer 中创建了表单,他们将其复制并粘贴到 Rails 中。要以表单声明真实性令牌,最佳解决方案可能是使用表单助手 http://guides。 rubyonrails.org/form_helpers.html
此令牌必须存在才能防止 CSRF 攻击。
One condition that causes it to sign out is a missing authenticity_token as one of the input values of a form. This happened to me because I created the form in Kompozer them copied and pasted it into Rails. To declare the authenticity token in the form the best solution would probably be to use the form helper http://guides.rubyonrails.org/form_helpers.html
This token must exist to prevent CSRF attacks.