How to set a timeout using development?

Model:

devise :database_authenticatable, :registerable,:timeoutable, :recoverable, :rememberable, :trackable, :validatable,:timeout_in => 10.seconds 

development.rb:

 config.timeout_in = 10.seconds 

devise.rb:

 config.timeout_in = 10.seconds 
+6
source share
2 answers

Do you expect to refresh the page and see the login page again? If so, then not how the timeout works. If you expect it to present you with the login page during the upgrade, remove the timeout part from your model and put NOT development.rb in devise.rb. Remember to restart the rails server.

 config.timeout_in = 1.hour 

All of this is described in the wiki here .

Also, am I not sure about the logic in 10 seconds? Seems too short. If it still does not work, increase (for example) five minutes and check.

+5
source

It is also possible to dynamically set the timeout_in parameter

 class User < ActiveRecord::Base devise (...), :timeoutable def timeout_in if self.admin? 1.year else 2.days end end end 
+4
source

Source: https://habr.com/ru/post/915171/


All Articles