Class: CASinoCore::Model::TwoFactorAuthenticator
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- CASinoCore::Model::TwoFactorAuthenticator
- Defined in:
- lib/casino_core/model/two_factor_authenticator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cleanup ⇒ Object
8 9 10 |
# File 'lib/casino_core/model/two_factor_authenticator.rb', line 8 def self.cleanup self.delete_all(['(created_at < ?) AND active = ?', self.lifetime.ago, false]) end |
.lifetime ⇒ Object
12 13 14 |
# File 'lib/casino_core/model/two_factor_authenticator.rb', line 12 def self.lifetime CASinoCore::Settings.two_factor_authenticator[:lifetime_inactive].seconds end |
Instance Method Details
#expired? ⇒ Boolean
16 17 18 |
# File 'lib/casino_core/model/two_factor_authenticator.rb', line 16 def expired? !self.active? && (Time.now - (self.created_at || Time.now)) > self.class.lifetime end |