module Devise::Models::Timeoutable

Timeoutable takes care of verifying whether a user session has already expired or not. When a session expires after the configured time, the user will be asked for credentials again, it means, they will be redirected to the sign in page.

Options

Timeoutable adds the following options to devise_for:

* +timeout_in+: the interval to timeout the user session without activity.

Examples

user.timedout?(30.minutes.ago)

Public Class Methods

required_fields(klass) click to toggle source
# File lib/devise/models/timeoutable.rb, line 24
def self.required_fields(klass)
  []
end

Public Instance Methods

timedout?(last_access) click to toggle source

Checks whether the user session has expired based on configured time.

# File lib/devise/models/timeoutable.rb, line 29
def timedout?(last_access)
  !timeout_in.nil? && last_access && last_access <= timeout_in.ago
end
timeout_in() click to toggle source
# File lib/devise/models/timeoutable.rb, line 33
def timeout_in
  self.class.timeout_in
end