Sha256: cde7eec9015cd2001ced904393d1b086c325ab43ce2b9e8404a59c13143024dd

Contents?: true

Size: 397 Bytes

Versions: 7

Compression:

Stored size: 397 Bytes

Contents

class CASino::TwoFactorAuthenticator < ActiveRecord::Base
  belongs_to :user

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
casino-3.0.4 app/models/casino/two_factor_authenticator.rb
casino-3.0.3 app/models/casino/two_factor_authenticator.rb
casino-3.0.2 app/models/casino/two_factor_authenticator.rb
casino-3.0.1 app/models/casino/two_factor_authenticator.rb
casino-3.0.0 app/models/casino/two_factor_authenticator.rb
casino-3.0.0.pre.2 app/models/casino/two_factor_authenticator.rb
casino-3.0.0.pre.1 app/models/casino/two_factor_authenticator.rb