mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: second factor cannot be enabled if SSO is enabled (#10880)
* FIX: second factor cannot be enabled if SSO is enabled If `enable_sso` setting is enabled then admin should not be able to enable `enforce_second_factor` setting as that will lock users out. Co-authored-by: Robin Ward <robin.ward@gmail.com>
This commit is contained in:
@ -173,6 +173,9 @@ module SiteSettings::Validations
|
||||
end
|
||||
|
||||
def validate_enforce_second_factor(new_val)
|
||||
if SiteSetting.enable_sso?
|
||||
return validate_error :second_factor_cannot_be_enforced_with_sso_enabled
|
||||
end
|
||||
if new_val == "all" && Discourse.enabled_auth_providers.count > 0
|
||||
auth_provider_names = Discourse.enabled_auth_providers.map(&:name).join(", ")
|
||||
return validate_error(:second_factor_cannot_enforce_with_socials, auth_provider_names: auth_provider_names)
|
||||
|
Reference in New Issue
Block a user