Class: QuoVadis::Session
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- QuoVadis::Session
- Includes:
- IpMasking
- Defined in:
- app/models/quo_vadis/session.rb
Overview
A session is started once a user logs in with a password, regardless of whether 2FA is also required.
Instance Method Summary collapse
- #authenticated_with_second_factor ⇒ Object
- #expired? ⇒ Boolean
- #logout_other_sessions ⇒ Object
- #replace ⇒ Object
- #reset_authenticated_with_second_factor ⇒ Object
- #second_factor_authenticated? ⇒ Boolean
Methods included from IpMasking
Instance Method Details
#authenticated_with_second_factor ⇒ Object
20 21 22 |
# File 'app/models/quo_vadis/session.rb', line 20 def authenticated_with_second_factor touch :second_factor_at end |
#expired? ⇒ Boolean
32 33 34 |
# File 'app/models/quo_vadis/session.rb', line 32 def expired? exceeded_lifetime? || exceeded_idle_timeout? end |
#logout_other_sessions ⇒ Object
16 17 18 |
# File 'app/models/quo_vadis/session.rb', line 16 def logout_other_sessions account.sessions.reject { |s| s == self }.each &:destroy end |
#replace ⇒ Object
36 37 38 |
# File 'app/models/quo_vadis/session.rb', line 36 def replace destroy.dup.tap &:save end |
#reset_authenticated_with_second_factor ⇒ Object
24 25 26 |
# File 'app/models/quo_vadis/session.rb', line 24 def reset_authenticated_with_second_factor update second_factor_at: nil end |
#second_factor_authenticated? ⇒ Boolean
28 29 30 |
# File 'app/models/quo_vadis/session.rb', line 28 def second_factor_authenticated? !second_factor_at.nil? end |