Class: Devise::TwoFactorAuthenticationController

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

Instance Method Summary collapse

Instance Method Details

#resend_codeObject



20
21
22
23
# File 'app/controllers/devise/two_factor_authentication_controller.rb', line 20

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

#showObject



7
8
# File 'app/controllers/devise/two_factor_authentication_controller.rb', line 7

def show
end

#updateObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/devise/two_factor_authentication_controller.rb', line 10

def update
  render(:show, status: :unprocessable_entity) and return if params[:code].nil?

  if resource.authenticate_otp(params[:code])
    after_two_factor_success_for(resource)
  else
    after_two_factor_fail_for(resource)
  end
end