Class: CASino::TwoFactorAuthenticator
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- CASino::TwoFactorAuthenticator
- Defined in:
- app/models/casino/two_factor_authenticator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cleanup ⇒ Object
7 8 9 |
# File 'app/models/casino/two_factor_authenticator.rb', line 7 def self.cleanup self.delete_all(['(created_at < ?) AND active = ?', self.lifetime.ago, false]) end |
.lifetime ⇒ Object
11 12 13 |
# File 'app/models/casino/two_factor_authenticator.rb', line 11 def self.lifetime CASino.config.two_factor_authenticator[:lifetime_inactive].seconds end |
Instance Method Details
#expired? ⇒ Boolean
15 16 17 |
# File 'app/models/casino/two_factor_authenticator.rb', line 15 def expired? !self.active? && (Time.now - (self.created_at || Time.now)) > self.class.lifetime end |