使用Devise设置会话长度 [英] Setting session length with Devise

查看:128
本文介绍了使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆