Fix strict routing for frontend forms #48022#48028
Conversation
|
@samson1299 Please use the structure of our pull request template and don't remove things when creating pull request. Especially confirm that you have read our Generative AI policy by entering Thanks in advance. |
|
System tests for password reset are failing (test |
|
|
|
Real-world case that shows why this matters: on a Joomla 6.1.1 site we manage, the form action on the "remind username" page still inherits This kind of self-referencing, ever-redirecting URL is exactly the sort of thing that trips up crawlers and third-party tooling that parses or caches URLs (in our case we first noticed it via PHP warnings in an unrelated caching plugin that tried to derive a filesystem path from the URL). |
|
Unfortunately the system tests are failing here, and it might be related to the changes in this PR. We will investigate. |
|
Tested this on a live Joomla 6.1.2 site (as a template override, to avoid patching core directly) that was actively hitting the bug described in #48022. Confirmed:
Regarding the failing Reset.cy.js system test: looking at that test file, one of its scenarios specifically submits the reset form via a menu-item link and then checks that the resulting email links back to that same menu-item context. Since this PR changes the form action to a bare index.php?option=com_users (no route context) plus a hidden task field, my guess is that's exactly what breaks — the menu-item/SEF context that used to ride along in the form action route is now lost. Might be worth checking whether the fix needs to preserve the current route context (e.g. via Route::_('index.php?option=com_users', false) relative to the current Itemid, or explicitly carrying an Itemid hidden field) rather than dropping it entirely. |
Fixes #48022.
Summary of Changes
This pull request removes the redundant
viewquery parameter from the frontend Reset Password and Remind Username form action URLs.The following files are updated:
components/com_users/tmpl/reset/default.phpcomponents/com_users/tmpl/remind/default.phpThe forms already render within the correct view, so including the
viewparameter in the form action is unnecessary. The generated form action now contains only the requiredtaskparameter while preserving the existing functionality.Testing Instructions
<form>element.actionattribute no longer contains theviewparameter.Actual result BEFORE applying this Pull Request
The generated form action URLs include an unnecessary
viewquery parameter, for example:These URLs create unnecessary URL variations even though the forms are already rendered within the correct view.
Expected result AFTER applying this Pull Request
The generated form action URLs no longer include the redundant
viewquery parameter. The forms continue to function correctly using only the requiredtaskparameter, resulting in cleaner URLs.Link to documentations
Please select:
No documentation changes for guide.joomla.org needed
No documentation changes for manual.joomla.org needed