Module: TwoFactorAuth::AuthenticationsHelper
- Included in:
- AuthenticationsController
- Defined in:
- app/helpers/two_factor_auth/authentications_helper.rb
Instance Method Summary collapse
- #authentication_request ⇒ Object
- #clear_pending_authentication_challenge ⇒ Object
- #two_factor_auth_authentication ⇒ Object
- #user_two_factor_auth_authenticated!(counter) ⇒ Object
- #user_two_factor_auth_authenticated? ⇒ Boolean
Instance Method Details
#authentication_request ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/helpers/two_factor_auth/authentications_helper.rb', line 25 def authentication_request @authentication_request ||= AuthenticationRequest.new( TwoFactorAuth.trusted_facet_list_url, Registration.key_handle_for_authentication(current_user), user_session['pending_authentication_request_challenge'] ) user_session['pending_authentication_request_challenge'] = @authentication_request.challenge @authentication_request end |
#clear_pending_authentication_challenge ⇒ Object
35 36 37 38 |
# File 'app/helpers/two_factor_auth/authentications_helper.rb', line 35 def clear_pending_authentication_challenge @authentication_request = nil user_session.delete 'pending_authentication_request_challenge' end |
#two_factor_auth_authentication ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/helpers/two_factor_auth/authentications_helper.rb', line 3 def two_factor_auth_authentication if user_signed_in? and !user_two_factor_auth_authenticated? redirect_to new_two_factor_auth_authentication_path return false end true end |
#user_two_factor_auth_authenticated!(counter) ⇒ Object
15 16 17 18 |
# File 'app/helpers/two_factor_auth/authentications_helper.rb', line 15 def user_two_factor_auth_authenticated! counter Registration.authenticated(current_user, counter) user_session['two_factor_auth_authenticated'] = Time.now end |
#user_two_factor_auth_authenticated? ⇒ Boolean
11 12 13 |
# File 'app/helpers/two_factor_auth/authentications_helper.rb', line 11 def user_two_factor_auth_authenticated? user_session['two_factor_auth_authenticated'].present? end |