Module: TwoFactorAuth::RegistrationsHelper

Included in:
RegistrationsController
Defined in:
app/helpers/two_factor_auth/registrations_helper.rb

Instance Method Summary collapse

Instance Method Details

#clear_pending_registration_challengeObject



25
26
27
28
# File 'app/helpers/two_factor_auth/registrations_helper.rb', line 25

def clear_pending_registration_challenge
  @registration_request = nil
  user_session.delete 'pending_registration_request_challenge'
end

#registration_requestObject



15
16
17
18
19
20
21
22
23
# File 'app/helpers/two_factor_auth/registrations_helper.rb', line 15

def registration_request
  @registration_request ||= RegistrationRequest.new(
    TwoFactorAuth.trusted_facet_list_url,
    [],
    user_session['pending_registration_request_challenge']
  )
  user_session['pending_registration_request_challenge'] = @registration_request.challenge
  @registration_request
end

#two_factor_auth_registrationObject



7
8
9
10
11
12
13
# File 'app/helpers/two_factor_auth/registrations_helper.rb', line 7

def two_factor_auth_registration
  if user_signed_in? and !user_two_factor_auth_registered?
    redirect_to new_two_factor_auth_registrations_path
    return false
  end
  true
end

#user_two_factor_auth_registered?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'app/helpers/two_factor_auth/registrations_helper.rb', line 3

def user_two_factor_auth_registered?
  current_user.registrations.any?
end