使用webrat时登录失败

发布于 2024-10-02 04:25:23 字数 357 浏览 0 评论 0原文

我在rails 2.3.5上使用restful_authentication 1.1.6并使用webrat 0.7.1进行测试 当我使用浏览器测试时,登录工作正常。什么时候 我使用 webrat,它首先正确登录并设置 current_user 和 session[:user_id]。 然后,当在操作结束时执行重定向时(:controller => session, :action => create),它将 session[:user_id] 和 current_user 设置为 nil! 仅当末尾有重定向时才会发生这种情况。如果存在“render :text”,那么session[:user_id]和current_user的值将不会被删除! 有什么想法,我该如何解决这个问题?

I am using restful_authentication 1.1.6 on rails 2.3.5 and testing with webrat 0.7.1
The login works fine when I use a browser to test it. When
I use webrat, it first correctly logs in and sets the current_user and session[:user_id].
Then, when performing the redirect at the end of the action (:controller => session, :action => create), it sets the session[:user_id] and current_user to nil!
This happens only when there is a redirect at the end. If there is a “render :text”, then the values of session[:user_id] and current_user will not be erased!
Any ideas, how I can fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我为君王 2024-10-09 04:25:23

原来我冻结了错误版本的rails(2.3.8)。我冻结了 2.3.5 版本后一切正常。

It turned out I froze wrong version of rails (2.3.8). Everything works fine after I froze version 2.3.5.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文