Class: Devise::DeviseXfactorAuthenticationController

Inherits:
DeviseController
  • Object
show all
Defined in:
app/controllers/devise/devise_xfactor_authentication_controller.rb

Instance Method Summary collapse

Instance Method Details

#resend_codeObject



23
24
25
26
# File 'app/controllers/devise/devise_xfactor_authentication_controller.rb', line 23

def resend_code
  resource.send_new_otp
  redirect_to send("#{resource_name}_devise_xfactor_authentication_path"), notice: I18n.t('devise.devise_xfactor_authentication.code_has_been_sent')
end

#showObject



7
8
9
10
11
# File 'app/controllers/devise/devise_xfactor_authentication_controller.rb', line 7

def show
  unless resource.uses_two_factor?
    after_devise_xfactor_success_for(resource)
  end
end

#updateObject



13
14
15
16
17
18
19
20
21
# File 'app/controllers/devise/devise_xfactor_authentication_controller.rb', line 13

def update
  render :show and return if params[:code].nil?

  if resource.authenticate_otp(params[:code])
    after_devise_xfactor_success_for(resource)
  else
    after_devise_xfactor_fail_for(resource)
  end
end