[英]Browser URL not changing after session timeout (Rails/Devise)
This is a more general question based on this one that I had (I realized that the issue I'm having may not be specific to the particular question I had (or possibly not even Devise related) so I figured I would try to reword it. 这是基于我所遇到的一个更普遍的问题(我意识到我所遇到的问题可能并不特定于我所遇到的特定问题(甚至可能与Devise不相关),因此我认为我会尝试重新措辞。
Basically, if a user has multiple tabs of the same session open and they log out, they might go elsewhere in a different tab and it will take them to the sign in page because their session was just killed. 基本上,如果用户打开了同一会话的多个选项卡并注销,则他们可能会转到其他选项卡中的其他位置,并且由于会话被终止,因此会将其带到登录页面。 The issue seems to be that the browser url is not changing to the correct user sign in url.
问题似乎是浏览器网址未更改为正确的用户登录网址。 Instead, the url is the same as the one the user just tried to go to.
相反,该URL与用户刚尝试访问的URL相同。 Because of this, nothing happens when the user enters its credentials and hits the login submit button.
因此,当用户输入其凭据并单击登录提交按钮时,什么也不会发生。
I believe this is because the sign in page is being rendered rather than redirected. 我认为这是因为登录页面正在呈现而不是重定向。 if I refresh the page, the url changes to what it should be and I can login as per normal.
如果刷新页面,则URL更改为应有的样子,并且可以正常登录。
Here are what my routes look like if that helps: 如果有帮助,以下是我的路线:
devise_scope :user do
authenticated :user do
root to: "users#dashBoard", as: :authenticated_root, foo: 'dashBoard'
end
unauthenticated :user do
root to: "devise/sessions#new"
end
end
The answer was right in front of me. 答案就在我眼前。 I removed Turbolinks from the app and that fixed the issue.
我从应用程序中删除了Turbolinks,并解决了该问题。 Basically, because of Turbolinks it was just rendering the page without actually reloading anything (javascript files etc).
基本上,由于Turbolinks,它只是呈现页面而没有实际重新加载任何内容(javascript文件等)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.