mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:34:31 +08:00
FIX: Error message when setting enforce 2fa with social logins (#10479)
This commit is contained in:

committed by
GitHub

parent
298ed5d021
commit
a3c0d4a8b5
@ -115,10 +115,10 @@ describe SiteSettings::Validations do
|
||||
end
|
||||
end
|
||||
|
||||
describe "enforce second factor & local login interplay" do
|
||||
describe "enforce second factor & local/auth provider login interplay" do
|
||||
describe "#validate_enforce_second_factor" do
|
||||
let(:error_message) { I18n.t("errors.site_settings.second_factor_cannot_be_enforced_with_disabled_local_login") }
|
||||
context "when local logins are disabled" do
|
||||
let(:error_message) { I18n.t("errors.site_settings.second_factor_cannot_be_enforced_with_disabled_local_login") }
|
||||
before do
|
||||
SiteSetting.enable_local_logins = false
|
||||
end
|
||||
@ -137,6 +137,18 @@ describe SiteSettings::Validations do
|
||||
expect { subject.validate_enforce_second_factor("t") }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context "when social logins are enabled" do
|
||||
let(:error_message) { I18n.t("errors.site_settings.second_factor_cannot_enforce_with_socials", auth_provider_names: "facebook, github") }
|
||||
before do
|
||||
SiteSetting.enable_facebook_logins = true
|
||||
SiteSetting.enable_github_logins = true
|
||||
end
|
||||
|
||||
it "raises and error, and specifies the auth providers" do
|
||||
expect { subject.validate_enforce_second_factor("all") }.to raise_error(Discourse::InvalidParameters, error_message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#validate_enable_local_logins" do
|
||||
|
Reference in New Issue
Block a user