Browse Source

Less patching upstream

pull/270/head
baarkerlounger 3 years ago
parent
commit
9ceade9833
  1. 16
      Gemfile.lock
  2. 20
      app/controllers/auth/two_factor_authentication_controller.rb

16
Gemfile.lock

@ -20,7 +20,7 @@ GIT
GIT GIT
remote: https://github.com/baarkerlounger/two_factor_authentication.git remote: https://github.com/baarkerlounger/two_factor_authentication.git
revision: 276a896d4f8f4186b199588f8b8900abb8b24a9a revision: 1fa214d18d311e019a343f836f2c591c0fa3d308
specs: specs:
two_factor_authentication (2.2.0) two_factor_authentication (2.2.0)
devise devise
@ -116,17 +116,17 @@ GEM
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2) ast (2.4.2)
aws-eventstream (1.2.0) aws-eventstream (1.2.0)
aws-partitions (1.551.0) aws-partitions (1.552.0)
aws-sdk-core (3.125.6) aws-sdk-core (3.126.0)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0) aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
jmespath (~> 1.0) jmespath (~> 1.0)
aws-sdk-kms (1.53.0) aws-sdk-kms (1.54.0)
aws-sdk-core (~> 3, >= 3.125.0) aws-sdk-core (~> 3, >= 3.126.0)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.111.3) aws-sdk-s3 (1.112.0)
aws-sdk-core (~> 3, >= 3.125.0) aws-sdk-core (~> 3, >= 3.126.0)
aws-sdk-kms (~> 1) aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4) aws-sigv4 (~> 1.4)
aws-sigv4 (1.4.0) aws-sigv4 (1.4.0)
@ -170,7 +170,7 @@ GEM
railties (>= 3.2) railties (>= 3.2)
encryptor (3.0.0) encryptor (3.0.0)
erubi (1.10.0) erubi (1.10.0)
excon (0.90.0) excon (0.91.0)
factory_bot (6.2.0) factory_bot (6.2.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
factory_bot_rails (6.2.0) factory_bot_rails (6.2.0)

20
app/controllers/auth/two_factor_authentication_controller.rb

@ -2,4 +2,24 @@ class Auth::TwoFactorAuthenticationController < Devise::TwoFactorAuthenticationC
def show_resend def show_resend
render "devise/two_factor_authentication/resend" render "devise/two_factor_authentication/resend"
end end
def update
resource.errors.add :base, I18n.t("devise.two_factor_authentication.code_required") if resource && params_code.empty?
super
end
private
def after_two_factor_fail_for(resource)
resource.second_factor_attempts_count += 1
resource.save!
if resource.max_login_attempts?
sign_out(resource)
render :max_login_attempts_reached, status: :unprocessable_entity
else
resource.errors.add :base, I18n.t("devise.two_factor_authentication.code_incorrect") if resource
render :show, status: :unprocessable_entity
end
end
end end

Loading…
Cancel
Save