Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure time out using devise?

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
like image 636
user1381579 Avatar asked May 08 '12 08:05

user1381579


1 Answers

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
like image 92
rusllonrails Avatar answered Sep 26 '22 07:09

rusllonrails