Class: Booth::Models::Onboarding

Inherits:
ApplicationRecord show all
Defined in:
lib/booth/models/onboarding.rb

Overview

Log in via a special URL, forcing you to delete all your existing authenticators.

Instance Method Summary collapse

Instance Method Details

#consumed?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/booth/models/onboarding.rb', line 29

def consumed?
  consumed_at.present?
end

#lifespanObject

Distinguish “first time onboarding” from high-stakes “I lost my authenticator”.



21
22
23
24
25
26
27
# File 'lib/booth/models/onboarding.rb', line 21

def lifespan
  if credential.authenticators.any?
    12.hours
  else
    1.week
  end
end

#timed_out?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/booth/models/onboarding.rb', line 33

def timed_out?
  created_at < lifespan.ago
end