auth: redirect to the originally requested page after login (#1946)#1961
auth: redirect to the originally requested page after login (#1946)#1961kaligrafy wants to merge 1 commit into
Conversation
…bilite#1946) When an unauthenticated user opened a protected URL (e.g. an account verification link), PrivateRoute sent them to /login but did not remember where they came from, so after logging in they always landed on the home page and had to click the original link again. The post-login redirect logic already existed: redirectAfterLogin reads location.state.referrer. PrivateRoute now supplies it, capturing the requested path and passing it as the login navigation state, so the user is sent back to the originally requested URL after authenticating. Adds a unit test for the redirect state and a Playwright UI test reproducing the verify-link scenario, plus a reusable goToUrlTest helper. closes chairemobilite#1946 Code by Claude Opus 4.8 Low thinking, reviewed by @kaligrafy
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/project-rule.mdc)
Files:
**/*.test.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/project-rule.mdc)
Files:
**/*.ts📄 CodeRabbit inference engine (.cursor/rules/project-rule.mdc)
Files:
🧠 Learnings (1)📚 Learning: 2026-02-24T00:36:44.483ZApplied to files:
🔇 Additional comments (4)
WalkthroughThis PR adds referrer tracking to unauthenticated redirects in Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
When an unauthenticated user opened a protected URL (e.g. an account verification link), PrivateRoute sent them to /login but did not remember where they came from, so after logging in they always landed on the home page and had to click the original link again.
The post-login redirect logic already existed: redirectAfterLogin reads location.state.referrer. PrivateRoute now supplies it, capturing the requested path and passing it as the login navigation state, so the user is sent back to the originally requested URL after authenticating.
Adds a unit test for the redirect state and a Playwright UI test reproducing the verify-link scenario, plus a reusable goToUrlTest helper.
closes #1946
Code by Claude Opus 4.8 Low thinking, reviewed by @kaligrafy
Summary by CodeRabbit
New Features
Tests