Submit the guest order tracking form with POST - #1097
Conversation
|
Hi @boo-code, good finding! Guest → customer account transformation breaks. To reproduce → look up a guest order, then submit a weak password. Expected something like "Customer password is too weak" actual is a silent redirect back to the tracking form. Fix → Pass Also worth adding while you're there: that password field has no strength meter, though core gates it with Have a working patch locally if useful 👍 |
The form carries the shopper's email address, and submitting it with GET puts that address in the URL. It is then recorded by analytics as a page path, kept in the browser history and written to the access log and any referrer. The controller reads the fields with Tools::getValue(), which takes POST as well, so no controller change is needed and links that already carry the parameters in a query string keep working.
The transformation form posts back to the page URL, and with the tracking form posted that URL no longer carries order_reference and email, so the controller returned before reaching the transformation and the shopper was sent back to the lookup form with no message. The tracking page now passes both to the partial, which posts them as hidden fields. Order confirmation includes the same partial without them and is unchanged.
d07b504 to
d389aae
Compare
|
@tblivet Fixed the way you describe: The strength meter is not in this change: |
|
Thank you @boo-code it's all good 👍 ✅ QA approved. PrestaShop 9.3.0, Hummingbird 2.1.0, PHP 8.1.33, front office, Chromium. The five steps were run twice on the same shop: once on the commit this branch started from ( Before: the lookup left the address bar reading Passing in both runs, so nothing regressed: the order is still found; a link that already carries One correction to the test plan. Step 5 says that before the fix the lookup form comes back with no message. On the merge base it does not: the message appears there too. That step describes the state between the two commits rather than the state before them, and it does not change the outcome. Front page, product page and cart answered in both runs, at full width and at 375 and 768 wide, with no console or network errors. After video: |
Why
templates/customer/guest-login.tplsubmits the tracking form withmethod="get", and the form holds afield named
email. Submitting it therefore produces a URL of the shape/guest-tracking?order_reference=...&email=someone@example.com.That is the report in PrestaShop/PrestaShop#13911: email addresses visible in Google Analytics page
paths. A URL carrying the address does not only reach analytics - it is also kept in the browser history,
written to the web server access log, and sent as the referrer to anything the page loads.
What it does
Switches the form to
method="post".Tools::getValue()reads$_POSTbefore$_GET(classes/Tools.php), andGuestTrackingControllerreads
order_referenceandemailthrough it, so no controller change is needed. Links that alreadycarry the parameters in a query string keep working, since the controller still accepts them.
The hidden
controllerinput is left in place. It exists because a GET form replaces the action's querystring with its own fields; with POST the action's query string is preserved and the input is simply
harmless.
The account transformation form
customer/_partials/account-transformation-form.tplposts back to the page URL with only the password. Withthe lookup in the query string that URL carried
order_referenceandemail; once the lookup is posted itdoes not, so
GuestTrackingController::postProcess()returned at its empty-input check and the shopper was sentback to the lookup form with no message.
guest-tracking.tplnow passes both to the partial, which posts them ashidden fields. Order confirmation includes the same partial without them and resolves the order from the cart, so
it renders nothing extra there.
How to test
...&email=someone@example.com. After: the URL carries no email.?order_reference=...&email=...still resolves the order.comes back with no message. After: "Your password length must be between 8 and 72" (or the score message),
and a valid password converts the guest into a customer account.