James Postadan | Oct2025-2 | Module Legacy Code | Sprint 1 | Login from profile page - #2
Open
japostadan wants to merge 2 commits into
Open
James Postadan | Oct2025-2 | Module Legacy Code | Sprint 1 | Login from profile page#2japostadan wants to merge 2 commits into
japostadan wants to merge 2 commits into
Conversation
The profile view wired the login handler to a click on a non-existent [data-action="proxy.php?url=https%3A%2F%2Fgithub.com%2Fjapostadan%2FModule-Legacy-Code%2Fpull%2Flogin"] element, so the login form rendered on a profile page had no submit handler. Submitting it triggered a native form POST to the static file server (501 on python http.server, 405 on nginx) instead of authenticating. - Wire the profile-page login form to its submit event, matching the home login view (lib uses handleLogin which preventDefaults). - Add a Playwright regression test: login -> view profile -> logout -> log back in from the profile page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Summary
submitevent so it no longer triggers a native browser POST🧾 Changelist
views/profile.mjsbound the login handler to a click ondocument.querySelector("[data-action="proxy.php?url=https%3A%2F%2Fgithub.com%2Fjapostadan%2FModule-Legacy-Code%2Fpull%2Flogin"]"), but the login template's link isdata-action="proxy.php?url=https%3A%2F%2Fgithub.com%2Fjapostadan%2FModule-Legacy-Code%2Fpull%2Fsignup"— thedata-action="proxy.php?url=https%3A%2F%2Fgithub.com%2Fjapostadan%2FModule-Legacy-Code%2Fpull%2Flogin"element only exists in the signup template. So the selector returnednulland the profile-page login form had no submit handler. With nothing callingevent.preventDefault(), the browser performed a native form POST to the static server, which answers501 Unsupported method ('POST')(pythonhttp.server) /405(nginx).submitevent —querySelector("[data-form='login']").addEventListener("submit", handleLogin)— matching the working homeviews/login.mjs.tests/profile-login.spec.mjs(login → view profile → logout → log back in from the profile page). Red before the fix, green after. Full Playwright suite passes 14/14 against the real backend.❓ Questions
/profile/<user>) rather than the hash routes the router actually handles — should that path/hash inconsistency be tracked as its own issue?🙌 Notes for Reviewers
docker compose up -d --build frontend, then log in assample/sosecret, open a user's profile, log out, and log back in from that profile page — you stay logged in with no error page.