mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:45:26 +08:00
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:

committed by
GitHub

parent
9568a7e542
commit
cc4c199680
@ -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
|
||||
|
Reference in New Issue
Block a user