如何使用设计配置超时? [英] How to configure time out using devise?

查看:14
本文介绍了如何使用设计配置超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

型号:

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

development.rb:

development.rb:

config.timeout_in = 10.seconds

设计.rb:

config.timeout_in = 10.seconds

推荐答案

也可以动态设置 timeout_in 选项

Also it's possible to set timeout_in option dynamically

class User < ActiveRecord::Base
  devise (...), :timeoutable

  def timeout_in
    if self.admin? 
      1.year
    else
      2.days
    end
  end
end

这篇关于如何使用设计配置超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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