Browse Source

Allow form to be created with model

pull/2/head
baarkerlounger 3 years ago
parent
commit
649be2bed9
  1. 8
      app/controllers/devise/two_factor_authentication_controller.rb

8
app/controllers/devise/two_factor_authentication_controller.rb

@ -8,9 +8,9 @@ class Devise::TwoFactorAuthenticationController < DeviseController
end end
def update def update
render :show and return if params[:code].nil? render :show, status: :unprocessable_entity and return if params_code.empty?
if resource.authenticate_otp(params[:code]) if resource.authenticate_otp(params_code)
after_two_factor_success_for(resource) after_two_factor_success_for(resource)
else else
after_two_factor_fail_for(resource) after_two_factor_fail_for(resource)
@ -81,4 +81,8 @@ class Devise::TwoFactorAuthenticationController < DeviseController
render :max_login_attempts_reached and return render :max_login_attempts_reached and return
end end
end end
def params_code
params[:code] || params.dig(resource_name, :code)
end
end end

Loading…
Cancel
Save