Skip to content

James Postadan | Oct2025-2 | Module Legacy Code | Sprint 1 | Login from profile page - #2

Open
japostadan wants to merge 2 commits into
mainfrom
issue-06-login-from-profile
Open

James Postadan | Oct2025-2 | Module Legacy Code | Sprint 1 | Login from profile page#2
japostadan wants to merge 2 commits into
mainfrom
issue-06-login-from-profile

Conversation

@japostadan

Copy link
Copy Markdown
Owner

🎯 Summary

  • * Fixed: logging in from a profile page now works (previously errored with a 501 page)
  • * Wired the profile-page login form to its submit event so it no longer triggers a native browser POST
  • * Added a Playwright regression test for the full reproduction flow

🧾 Changelist

  • Root cause: views/profile.mjs bound the login handler to a click on document.querySelector("[data-action="proxy.php?url=https%3A%2F%2Fgithub.com%2Fjapostadan%2FModule-Legacy-Code%2Fpull%2Flogin"]"), but the login template's link is data-action="proxy.php?url=https%3A%2F%2Fgithub.com%2Fjapostadan%2FModule-Legacy-Code%2Fpull%2Fsignup" — the data-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 returned null and the profile-page login form had no submit handler. With nothing calling event.preventDefault(), the browser performed a native form POST to the static server, which answers 501 Unsupported method ('POST') (python http.server) / 405 (nginx).
  • Fix: bind the login form's submit event — querySelector("[data-form='login']").addEventListener("submit", handleLogin) — matching the working home views/login.mjs.
  • Tests: added 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

  • Bloom username links point to real paths (/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

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.
@japostadan japostadan self-assigned this Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant