Devise - Timeout not working

2019-07-03 10:34发布

问题:

Devise does not time out a user in the following scenario:

A user logs in, closes the tab, and then re-visits the URL in timeout + X minutes. The user is still logged in.

Timeouts work properly if the tab is already open, and is refreshed/clicked later. Which means the timeoutable module is working properly for this scenario.

Also so far, I've only been able to reproduce this in non localhost environments.

This question has also been asked before on the Devise groups, with no answer.

Versions:

Devise 2.2.4

Rails 3.2.13

Any help would be much appreciated !

回答1:

I managed to fix this by uncommenting config.timeout_in = 30.minutes in devise.yml. It says that the default is 30 minutes but it was only by explicitly setting the timeout to 30 minutes in the config that I could make it work if the window/tab was closed.