FEATURE: optional 2FA enforcement (#27506)

A new admin setting called `enforce_second_factor_on_external_auth`. It allows users to authenticate using external providers even when 2FA is forced with `enforce_second_factor` site setting.
This commit is contained in:
Krzysztof Kotlarek
2024-06-19 09:32:30 +10:00
committed by GitHub
parent 9568a7e542
commit cc4c199680
9 changed files with 56 additions and 37 deletions

View File

@ -143,7 +143,8 @@ class Users::OmniauthCallbacksController < ApplicationController
end
def user_found(user)
if user.has_any_second_factor_methods_enabled?
if user.has_any_second_factor_methods_enabled? &&
SiteSetting.enforce_second_factor_on_external_auth
@auth_result.omniauth_disallow_totp = true
@auth_result.email = user.email
return