使用 Devise 设置会话长度 [英] Setting session length with Devise
本文介绍了使用 Devise 设置会话长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的设计会话在 1-3 小时未使用后超时(不确定具体多长时间).我该如何调整?
My sessions with devise timeout after 1-3 hours of non-use (not sure exactly how long). How can I adjust this?
我查看了文档,但似乎找不到相关设置.
I've looked over the docs and can't seem to find a setting for this.
推荐答案
查看 config/initializers/devise.rb.有很多配置设置,包括config.timeout_in
.我的版本中的默认值为 30 分钟.您也可以在模型本身上进行设置:
Look in config/initializers/devise.rb. There are a lot of configuration settings including config.timeout_in
. The default in my version is 30 minutes. You can also set it on the model itself:
class User < ActiveRecord::Base
devise :timeoutable, :timeout_in => 15.minutes
您现在还可以动态设置超时.
这篇关于使用 Devise 设置会话长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文