Repository navigation
Conversation
The API no longer creates a second account when a Google/Discord sign-in carries a verified email that already belongs to a player — it bounces back with `#login=email_exists` instead. Surface that. consumeLoginResult() reads the one-shot `login=` router arg and strips it from the URL so a refresh doesn't replay it, mirroring how the existing `link=` results are consumed. AccountModal renders it as a dismissible banner above the sign-in buttons, so the next action is already on screen. The copy deliberately doesn't name which provider the existing account uses: the visitor has only proven control of the email address, not of the account, so we say an account exists and stop there. No fallback for a return URL without `#modal=account` — BaseModal.open() always syncs the router hash before the user can reach a login button. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe change adds one-shot handling for the ChangesLogin error flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change adds user feedback for rejected duplicate sign-ins and clears the one-shot message after use; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant RouterArguments
participant AccountModal
participant consumeLoginResult
participant LoginErrorBanner
RouterArguments->>AccountModal: open with login=email_exists
AccountModal->>consumeLoginResult: consume login result
consumeLoginResult-->>AccountModal: return email_exists
AccountModal->>LoginErrorBanner: render localized warning
LoginErrorBanner-->>AccountModal: dismiss warning
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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 |
|
I'll cherry pick the one from main into v33 |
… of #5047) (#5048) ## Context `main` port of #5047 — same change, resolved against main's refactors. Paired with openfrontio/infra#531. The API no longer creates a second account when a Google/Discord sign-in carries a verified email that already belongs to a player; it bounces back with `#login=email_exists`. This surfaces that to the user instead of redirecting them home with no feedback. ## Change - `LoginResult.ts` — `consumeLoginResult()` reads the one-shot `login=` router arg and strips it from the URL so a refresh doesn't replay it. Sits alongside the existing `GoogleLinkResult.ts` and follows the same shape. - `AccountModal` renders a dismissible banner above the sign-in buttons. - One new `en.json` key. ## Copy > You already have an account with this email. Sign in to it, then link this account in settings. It deliberately **doesn't name which provider** the existing account uses — the visitor has only proven control of the email address, not of the account. ## Port notes The cherry-pick from `v33` conflicted; resolved toward main's structure rather than forcing it: - kept main's `consumeGoogleLinkResult(args)`, dropped v33's `handleLinkResult(args)` - did **not** reintroduce `consentBusy`, `renderLogoutButton`, or `account_modal.log_out` — main has moved those into `AccountSettingsModal` - import order fixed for main's `./utilities/PlayerProfileUrl` path Resulting diff is identical in shape to #5047, and `LoginResult.ts` is byte-identical across both branches. ## Testing Full suite: **278 files / 3227 tests passing**, `tsc --noEmit` and lint clean.⚠️ Unrelated heads-up: `tests/client/InventoryModal.test.ts` fails intermittently under full-suite load on pristine `origin/main` (verified with none of this branch's code present — 3-4 failures, different subset each run, 21/21 in isolation). It happened not to trip on the final run here, but it's flaky on main independent of this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
… of #5047) (#5048) `main` port of #5047 — same change, resolved against main's refactors. Paired with openfrontio/infra#531. The API no longer creates a second account when a Google/Discord sign-in carries a verified email that already belongs to a player; it bounces back with `#login=email_exists`. This surfaces that to the user instead of redirecting them home with no feedback. - `LoginResult.ts` — `consumeLoginResult()` reads the one-shot `login=` router arg and strips it from the URL so a refresh doesn't replay it. Sits alongside the existing `GoogleLinkResult.ts` and follows the same shape. - `AccountModal` renders a dismissible banner above the sign-in buttons. - One new `en.json` key. > You already have an account with this email. Sign in to it, then link this account in settings. It deliberately **doesn't name which provider** the existing account uses — the visitor has only proven control of the email address, not of the account. The cherry-pick from `v33` conflicted; resolved toward main's structure rather than forcing it: - kept main's `consumeGoogleLinkResult(args)`, dropped v33's `handleLinkResult(args)` - did **not** reintroduce `consentBusy`, `renderLogoutButton`, or `account_modal.log_out` — main has moved those into `AccountSettingsModal` - import order fixed for main's `./utilities/PlayerProfileUrl` path Resulting diff is identical in shape to #5047, and `LoginResult.ts` is byte-identical across both branches. Full suite: **278 files / 3227 tests passing**, `tsc --noEmit` and lint clean.⚠️ Unrelated heads-up: `tests/client/InventoryModal.test.ts` fails intermittently under full-suite load on pristine `origin/main` (verified with none of this branch's code present — 3-4 failures, different subset each run, 21/21 in isolation). It happened not to trip on the final run here, but it's flaky on main independent of this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Context
Paired with openfrontio/infra#531. The API no longer creates a second account when a Google/Discord sign-in carries a verified email that already belongs to a player — it bounces back with
#login=email_existsinstead. Without this PR the user is redirected home with no feedback at all and no idea why nothing happened.Change
LoginResult.ts—consumeLoginResult()reads the one-shotlogin=router arg and strips it from the URL so a refresh doesn't replay it. Mirrors how the existinglink=results are consumed.AccountModalrenders it as a dismissible banner above the sign-in buttons, so the next action is already on screen.en.jsonkey. No other translation files touched.Copy
It deliberately doesn't name which provider the existing account uses. The visitor has only proven control of the email address, not of the account, so we confirm an account exists and stop there.
Note on scope
No fallback for a return URL missing
#modal=account.BaseModal.open()always callsmodalRouter.syncOpened()before the user can reach a login button — including theshowPage("page-account")paths from Matchmaking/ClanModal/SinglePlayerModal — so the arg always arrives. A fallback would have been untested dead code.Testing
TDD: tests written and watched fail first.
consumeLoginResult: returns the result, ignores unrecognised values, strips the param, clears the hash when it was the only paramAccountModalrendering: banner shows after a rejected sign-in, absent on an ordinary open, dropped on reopenFull suite: 234 files / 2749 tests passing,
tsc --noEmitand lint clean.Landing on main too
Same change ported to
mainin a separate PR —AccountModal.tshas diverged there (GoogleLinkResult.ts/AccountSettingsModal.tsextracted), so it needed a real resolution rather than a clean pick.🤖 Generated with Claude Code