用户会话超时后无法立即登录(Devise Gem) [英] Can't login immediately following user session timeout (Devise Gem)

查看:485
本文介绍了用户会话超时后无法立即登录(Devise Gem)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题是,如果我的用户会话超时(使用devise gem),我会尝试去另一个屏幕,这会让我回到正确的登录页面。但是,该URL不会从超时之前的页面改变。

The issue I'm having is that if my user session gets timed out (using the devise gem), I'll try to go to another screen and it will take me back to the login page which is correct. However, the url does not change from the page I was trying to go to before the timeout.

所以例如,会话结束,但我仍然会被采取在这里,如果这是我在超时之前的标题: http:// localhost:3000 / users / edit

So for example, the session will end but I'll still be taken here if that's where I was heading before the timeout: http://localhost:3000/users/edit

这个问题是,它不允许我登录,直到我刷新页面 - 这改变了url: http:// localhost:3000 / users / sign_in

The problem with this is that it disallows me from logging in until I refresh the page--which changes the url to this instead: http://localhost:3000/users/sign_in.

任何想法?

编辑

日志代表同一会话的两个不同的浏览器选项卡。前两个段落显示用户注销,最后两个段落显示当用户(他们仍然看起来像在第二个选项卡上登录时)看起来如何尝试转到另一个页面。主要区别在于日志不显示第二个选项卡的已启动GET/ projects / messageChannel。但是当我刷新时它确实会出现。
下面的服务器日志:

The log represents two different browser tabs of the same session. The first two paragraphs show the user logging out and the last two paragraphs show what it looks like when the user (who still looks like they are logged in on the second tab) tries to go to a different page. The main difference is that the log doesn't show the "Started GET "/projects/messageChannel"" for the second tab. But it does appear when I hit a refresh. Server log below:

Started GET "/" for XXXXXXX at 2014-06-18 10:09:53 -0400
Processing by Devise::SessionsController#new as HTML
  Rendered layouts/_messages.html.erb (0.1ms)
  Rendered devise/sessions/new.html.erb within layouts/application (2.6ms)
  Rendered layouts/_navigation.html.slim (0.4ms)
Completed 200 OK in 11ms (Views: 10.1ms | ActiveRecord: 0.0ms)


Started GET "/projects/messageChannel" for XXXXXXX at 2014-06-18 10:09:53 -0400
Processing by ProjectsController#messageChannel as JSON
Completed 401 Unauthorized in 1ms


Started GET "/dashboard/2" for XXXXXXX at 2014-06-18 10:09:59 -0400
Processing by UsersController#dashBoard as HTML
  Parameters: {"foo"=>"dashBoard", "id"=>"2"}
Completed 401 Unauthorized in 1ms


Started GET "/users/sign_in" for XXXXXXX at 2014-06-18 10:09:59 -0400
Processing by Devise::SessionsController#new as HTML
  Rendered layouts/_messages.html.erb (0.1ms)
  Rendered devise/sessions/new.html.erb within layouts/application (2.3ms)
  Rendered layouts/_navigation.html.slim (0.4ms)
Completed 200 OK in 11ms (Views: 10.1ms | ActiveRecord: 0.0ms)


推荐答案

我的。我从应用程序中删除了Turbolinks,并解决了这个问题。基本上,由于Turbolinks它只是渲染页面,而不实际重新加载任何东西(javascript文件等)。

The answer was right in front of me. I removed Turbolinks from the app and that fixed the issue. Basically, because of Turbolinks it was just rendering the page without actually reloading anything (javascript files etc).

这篇关于用户会话超时后无法立即登录(Devise Gem)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆