A platform for community discussion. Free, open, simple.
FEATURE: Bump enable_local_logins_via_code upcoming change to beta (#42040)
discoursebotb7b153997033
diff --git a/config/site_settings.yml b/config/site_settings.ymlindex f36a365c58e..e7abea37b25 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -694,7 +694,7 @@ login:- enable_local_logins- enable_local_logins_via_emailupcoming_change:- status: "alpha"+ status: "beta"impact: "feature,all_members"learn_more_url: "https://meta.discourse.org/t/-/407068"permanent_warning: falsediff --git a/plugins/discourse-captcha/spec/system/signup_with_captcha_spec.rb b/plugins/discourse-captcha/spec/system/signup_with_captcha_spec.rbindex 0582320aed0..60b7b091896 100644--- a/plugins/discourse-captcha/spec/system/signup_with_captcha_spec.rb+++ b/plugins/discourse-captcha/spec/system/signup_with_captcha_spec.rb@@ -7,6 +7,10 @@ RSpec.describe "Signup with captcha" dobefore doSiteSetting.enable_local_logins = trueSiteSetting.discourse_captcha_enabled = true++ # The captcha outlet only exists on the password signup form, which the+ # code-based form replaces when enable_local_logins_via_code is on.+ SiteSetting.enable_local_logins_via_code = falseendcontext "with hCaptcha", allow_network: %w[hcaptcha.com *.hcaptcha.com] dodiff --git a/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb b/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rbindex d6ccc21db98..6f04fe2b2ce 100644--- a/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb+++ b/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb@@ -30,6 +30,10 @@ RSpec.describe "Discobot welcome post" doFabricate(:invite, invited_by: Fabricate(:admin), email: "[email protected]")end+ # Redeeming through the legacy form, which the email code flow replaces+ # when enable_local_logins_via_code is on.+ before { SiteSetting.enable_local_logins_via_code = false }+it "delays the welcome post until the user logs in" doexpect doput "/invites/show/#{invite.invite_key}.json",diff --git a/spec/lib/upcoming_changes_spec.rb b/spec/lib/upcoming_changes_spec.rbindex 5f704533cd0..404944a4962 100644--- a/spec/lib/upcoming_changes_spec.rb+++ b/spec/lib/upcoming_changes_spec.rb@@ -1335,6 +1335,10 @@ RSpec.describe UpcomingChanges doenddescribe ".should_display_enable_local_logins_via_code?" do+ # Pin the promotion threshold above the change's status so these specs+ # exercise the prerequisite branch rather than the auto-promoted one.+ before { SiteSetting.promote_upcoming_changes_on_status = :never }+it "returns true when local logins via email are possible" doexpect(UpcomingChanges::ConditionalDisplay.should_display?(:enable_local_logins_via_code),diff --git a/spec/requests/invites_controller_spec.rb b/spec/requests/invites_controller_spec.rbindex 0f3a1f98873..bca2f0e8472 100644--- a/spec/requests/invites_controller_spec.rb+++ b/spec/requests/invites_controller_spec.rb@@ -7,6 +7,11 @@ RSpec.describe InvitesController dodescribe "#show" dofab!(:invite)+ # These cover the legacy invite flow, which the email code flow replaces+ # when enable_local_logins_via_code is on. Examples that exercise the code+ # flow enable it for themselves.+ before { SiteSetting.enable_local_logins_via_code = false }+it "shows the accept invite page" doget "/invites/#{invite.invite_key}"expect(response.status).to eq(200)@@ -1351,6 +1356,11 @@ RSpec.describe InvitesController doenddescribe "#perform_accept_invitation" do+ # These cover the legacy invite flow, which the email code flow replaces+ # when enable_local_logins_via_code is on. Examples that exercise the code+ # flow enable it for themselves.+ before { SiteSetting.enable_local_logins_via_code = false }+context "when anonymous invite acceptance uses email codes" dofab!(:invite)diff --git a/spec/system/create_invite_with_roles_spec.rb b/spec/system/create_invite_with_roles_spec.rbindex 51365a82d5e..49378687db6 100644--- a/spec/system/create_invite_with_roles_spec.rb+++ b/spec/system/create_invite_with_roles_spec.rb@@ -12,7 +12,13 @@ describe "Creating invites with roles" dolet(:invite_form) { PageObjects::Pages::InviteForm.new }let(:cdp) { PageObjects::CDP.new }- before { SiteSetting.enable_invite_modal_with_roles = true }+ before do+ SiteSetting.enable_invite_modal_with_roles = true++ # Redemption here goes through the password invite form, which the email+ # code flow replaces when enable_local_logins_via_code is on.+ SiteSetting.enable_local_logins_via_code = false+ enddef open_invite_modal_for(current_user)user_invited_pending_page.visit(current_user)diff --git a/spec/system/login_spec.rb b/spec/system/login_spec.rbindex 380bdea83c3..b49144373e9 100644--- a/spec/system/login_spec.rb+++ b/spec/system/login_spec.rb@@ -112,6 +112,10 @@ shared_examples "login scenarios" doendcontext "with login link" do+ # The email login link is replaced by the code login flow when+ # enable_local_logins_via_code is on, which has its own spec.+ before { SiteSetting.enable_local_logins_via_code = false }+it "can login" dologin_form.open.fill_username("john").email_login_link@@ -362,28 +366,34 @@ shared_examples "login scenarios" doexpect(page).to have_css(".header-dropdown-toggle.current-user")end- it "can login with login link and totp" do- login_form.open.fill_username("john").email_login_link+ context "with login link" do+ # The email login link is replaced by the code login flow when+ # enable_local_logins_via_code is on, which has its own spec.+ before { SiteSetting.enable_local_logins_via_code = false }- login_link = wait_for_email_link(user, :email_login)- visit login_link- totp = ROTP::TOTP.new(user_second_factor.data).now- find(".second-factor-token-input").fill_in(with: totp)- find(".email-login-form .btn-primary").click+ it "can login with login link and totp" do+ login_form.open.fill_username("john").email_login_link- expect(page).to have_css(".header-dropdown-toggle.current-user")- end+ login_link = wait_for_email_link(user, :email_login)+ visit login_link+ totp = ROTP::TOTP.new(user_second_factor.data).now+ find(".second-factor-token-input").fill_in(with: totp)+ find(".email-login-form .btn-primary").click- it "can login with login link and backup code" do- login_form.open.fill_username("john").email_login_link+ expect(page).to have_css(".header-dropdown-toggle.current-user")+ end- login_link = wait_for_email_link(user, :email_login)- visit login_link- find(".toggle-second-factor-method").click- find(".second-factor-token-input").fill_in(with: "iAmValidBackupCode")- find(".email-login-form .btn-primary").click+ it "can login with login link and backup code" do+ login_form.open.fill_username("john").email_login_link- expect(page).to have_css(".header-dropdown-toggle.current-user")+ login_link = wait_for_email_link(user, :email_login)+ visit login_link+ find(".toggle-second-factor-method").click+ find(".second-factor-token-input").fill_in(with: "iAmValidBackupCode")+ find(".email-login-form .btn-primary").click++ expect(page).to have_css(".header-dropdown-toggle.current-user")+ endendit "can reset password with TOTP" dodiff --git a/spec/system/signup_spec.rb b/spec/system/signup_spec.rbindex 24ca617e8fe..e08b081b5c2 100644--- a/spec/system/signup_spec.rb+++ b/spec/system/signup_spec.rb@@ -9,6 +9,10 @@ shared_examples "signup scenarios" dolet(:invite) { Fabricate(:invite) }let(:topic) { Fabricate(:topic, title: "Super cool topic") }+ # These cover the password signup form. The code-based form replaces it when+ # enable_local_logins_via_code is on, and has its own spec.+ before { SiteSetting.enable_local_logins_via_code = false }+context "when anyone can create an account" dobefore { Jobs.run_immediately! }