Class: CASino::TwoFactorAuthenticator

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/casino/two_factor_authenticator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cleanupObject



5
6
7
# File 'app/models/casino/two_factor_authenticator.rb', line 5

def self.cleanup
  self.delete_all(['(created_at < ?) AND active = ?', self.lifetime.ago, false])
end

.lifetimeObject



9
10
11
# File 'app/models/casino/two_factor_authenticator.rb', line 9

def self.lifetime
  CASino.config.two_factor_authenticator[:lifetime_inactive].seconds
end

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/casino/two_factor_authenticator.rb', line 13

def expired?
  !self.active? && (Time.now - (self.created_at || Time.now)) > self.class.lifetime
end