Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index a5d8541c8ef..f0797e41c12 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1077,6 +1077,13 @@ class User < ApplicationRecord
update(otp_backup_codes: nil)
end
+ # Returns true if the user is allowed to sign in with either otp or recovery codes.
+ def sign_in_with_codes_allowed?
+ return two_factor_otp_enabled? unless Feature.enabled?(:webauthn_without_totp)
+
+ two_factor_enabled?
+ end
+
def two_factor_enabled?
two_factor_otp_enabled? || two_factor_webauthn_enabled?
end