FIX: Regression when enforced 2FA is enabled (#24415)

This commit is contained in:
Penar Musaraj
2023-11-16 11:52:12 -05:00
committed by GitHub
parent f19fd75af9
commit bcfb1a423d
4 changed files with 104 additions and 26 deletions

View File

@@ -109,13 +109,38 @@ describe "User preferences for Security", type: :system do
end
end
shared_examples "enforced second factor" do
it "allows user to add 2FA" do
SiteSetting.enforce_second_factor = "all"
visit("/")
expect(page).to have_selector(
".alert-error",
text: "You are required to enable two-factor authentication before accessing this site.",
)
expect(page).to have_css(".user-preferences .totp")
expect(page).to have_css(".user-preferences .security-key")
find(".user-preferences .totp .btn.new-totp").click
find(".dialog-body input#password").fill_in(with: password)
find(".confirm-session .btn-primary").click
expect(page).to have_css(".qr-code")
end
end
context "when desktop" do
include_examples "security keys"
include_examples "passkeys"
include_examples "enforced second factor"
end
context "when mobile", mobile: true do
include_examples "security keys"
include_examples "passkeys"
include_examples "enforced second factor"
end
end