简体   繁体   中英

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.

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. 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.

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. Basically, because of Turbolinks it was just rendering the page without actually reloading anything (javascript files etc).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM