It's currently possible for a site to deny anonymous users the ability to create accounts via the site-wide registration form but still see those same anonymous users create accounts via the checkout form. In some cases, this may be desired behavior, but in others it might be a surprise, which is unintended / unwanted.
There is some ambiguity here in that the settings form appears absolute but is not documented as required to be enforced by every third-party module that might create accounts. Thus, a compromise solution would be to at least:
- Signal in a checkout flow's configuration interface when its "Create a new account for an anonymous order" checkbox overrides the account settings form to permit account creation upon checkout completion.
- Signal the same in the "Login or continue as guest" checkout pane settings form.
- Signal the same in the "Guest registration after checkout" checkout pane settings form.
Issue fork commerce-3613532
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
velmir_taky commentedAdded the signal in all three spots. Since it's the same check and message each time, I pulled it into a
RegistrationConflictWarningTrait: it readsuser.settingsregister and, when that's set to administrators-only, returns amessages--warningelement linking to the account settings form.- Checkout flow config: shown next to "Create a new account for an anonymous order", with
#statesso it only appears while that checkbox is on.- Login pane: same, tied to "Allow registration".
- Guest registration after checkout pane: shown in its settings form (the pane being enabled is the toggle here).
config.factoryis injected viacreate()(property injection, no constructor change, so no BC break; PluginBase'sDependencySerializationTraithandles the service on serialize).Covered by
CheckoutFlowTest::testRegistrationConflictWarning— no warning while visitors can register, warning on all three once registration is admins-only.The
phpunitfailure isProductLayoutBuilderIntegrationTest::testProductWithoutVariationsDoesNotCrash(JSWebAssert:117, line 235 — a Views-wizard AJAX wait), unrelated to this MR:commerce_checkoutisn't even installed in that test, and the newtestRegistrationConflictWarningplus all checkout tests pass. Same failure is red on the pristine3.xscheduled pipeline (#905996) on core 11.4.4, so it's a pre-existing core-compat issue in that test, not something this change introduced.Comment #5
velmir_taky commented