DEV: Review fixes

This commit is contained in:
Martin Brennan 2024-06-12 16:24:09 +10:00
parent 7557381653
commit 01452ef569
No known key found for this signature in database
GPG Key ID: BD981EFEEC8F5675
1 changed files with 2 additions and 2 deletions

View File

@ -919,14 +919,14 @@ class ApplicationController < ActionController::Base
end end
def should_enforce_second_factor? def should_enforce_second_factor?
disqualified_from_2fa_enforcement = exempted_from_2fa_enforcement =
request.format.json? || is_api? || current_user.anonymous? || !current_user.local_login_only? request.format.json? || is_api? || current_user.anonymous? || !current_user.local_login_only?
enforcing_2fa = enforcing_2fa =
( (
(SiteSetting.enforce_second_factor == "staff" && current_user.staff?) || (SiteSetting.enforce_second_factor == "staff" && current_user.staff?) ||
SiteSetting.enforce_second_factor == "all" SiteSetting.enforce_second_factor == "all"
) )
!disqualified_from_2fa_enforcement && enforcing_2fa && !exempted_from_2fa_enforcement && enforcing_2fa &&
!current_user.has_any_second_factor_methods_enabled? !current_user.has_any_second_factor_methods_enabled?
end end