diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-08 15:07:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-08 15:07:28 +0300 |
commit | a0a2334dfd251af627aaf9e99486f8579087c3c9 (patch) | |
tree | 15419963fa8be8944d6a4fa056e0637f3ef94db9 /app/controllers/concerns/enforces_two_factor_authentication.rb | |
parent | d59bc6c73d927d63d04f86f8b1d2e471787d48d1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/concerns/enforces_two_factor_authentication.rb')
-rw-r--r-- | app/controllers/concerns/enforces_two_factor_authentication.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/app/controllers/concerns/enforces_two_factor_authentication.rb b/app/controllers/concerns/enforces_two_factor_authentication.rb index 24475909b62..81130fcd6a6 100644 --- a/app/controllers/concerns/enforces_two_factor_authentication.rb +++ b/app/controllers/concerns/enforces_two_factor_authentication.rb @@ -46,15 +46,11 @@ module EnforcesTwoFactorAuthentication end # rubocop: disable CodeReuse/ActiveRecord - def two_factor_authentication_reason(global: -> {}, group: -> {}) - if two_factor_authentication_required? - if Gitlab::CurrentSettings.require_two_factor_authentication? - global.call - else - groups = current_user.source_groups_of_two_factor_authentication_requirement.reorder(name: :asc) - group.call(groups) - end - end + def execute_action_for_2fa_reason(actions) + reason = two_factor_verifier.two_factor_authentication_reason + groups_enforcing_two_factor = current_user.source_groups_of_two_factor_authentication_requirement + .reorder(name: :asc) + actions[reason].call(groups_enforcing_two_factor) end # rubocop: enable CodeReuse/ActiveRecord |