Class: Devise::TwilioTwoFactorController

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

Instance Method Summary collapse

Instance Method Details

#authenticate_scope!Object



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

def authenticate_scope!
  self.resource = send("current_#{resource_name}")
end

#resend_codeObject



24
25
26
27
# File 'app/controllers/devise/twilio_two_factor_controller.rb', line 24

def resend_code
  resource.send_otp_code
  redirect_to send("#{resource_name}_twilio_two_factor_path"), notice: I18n.t('devise.twilio_two_factor.code_has_been_sent')
end

#showObject



11
12
# File 'app/controllers/devise/twilio_two_factor_controller.rb', line 11

def show
end

#updateObject



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

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

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