Class: TwoFactorAuth::RegistrationsController

Inherits:
TwoFactorAuthController show all
Includes:
RegistrationsHelper
Defined in:
app/controllers/two_factor_auth/registrations_controller.rb

Instance Method Summary collapse

Methods included from RegistrationsHelper

#clear_pending_registration_challenge, #registration_request, #two_factor_auth_registration, #user_two_factor_auth_registered?

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/two_factor_auth/registrations_controller.rb', line 11

def create
  verifier = RegistrationVerifier.new({
    login: current_user,
    request: registration_request,
    client_data: ClientData.new(encoded: params[:clientData], correct_typ: 'navigator.id.finishEnrollment'),
    response: RegistrationResponse.new(encoded: params[:registrationData]),
  })
  clear_pending_registration_challenge

  if verifier.save
    user_two_factor_auth_authenticated! 0 # don't need to auth again after registration
    redirect_to after_two_factor_auth_registration_path_for(current_user)
  else
    flash[:alert] = "Unable to register"
    render :new, status: 406
  end
end

#newObject



8
9
# File 'app/controllers/two_factor_auth/registrations_controller.rb', line 8

def new
end