Add guest to full account migration - #326
Merged
Merged
Conversation
migrateToRegistered only asks the server to mail a confirmation link; the account stays anonymous, and the session stays valid, until that link is redeemed. Migrating up front would strand the account on a mistyped address, since a guest has no password to recover with. refreshAccount reads GET /api/auth/account back into SessionStorage so a migration confirmed on another device becomes visible here. Its pendingEmail carries a pending address change for a registered user and a pending migration for an anonymous one, so callers read it together with userType. Also drops loginAnonymous: it posted to /api/auth/login-anonymous, which no version of the server has ever served.
Adds the upgrade screen and the ways into it. The form takes an email and a password and switches to a "check your inbox" phase; the account is untouched while that link is outstanding, so a typo costs one re-submit and the app keeps working throughout. The profile section shows the unconfirmed state as a callout rather than a row, because that in-between is easy to forget and is exactly when signing out still destroys everything. A guest signing out is therefore always asked to confirm, not only when writes are queued. pendingEmail is only read as a migration for anonymous users; for a registered one the same field means a pending address change.
Redeeming a link under an anonymous session can only be that account's upgrade: a guest has no address to change and no registration to confirm. The server keeps its sessions alive across that migration on purpose, so this path must not go through the session invalidator the email-change flow needs, and the screen offers a way back into the app instead of a sign-in. A link opened with an account already on the device confirms on a logged-in twin route, inside the app shell and on top of Home. The shell picks its navigation graph from the current route's type, so the plain key would flip to the logged-out graph, which has no entry for the Home underneath it. Leaving the screen now uncovers the app again instead of stranding a live session on Welcome.
The notice already promised an account could be created later, without saying where. Points at the profile entry that now exists, and says plainly that nothing is lost by taking it.
The refresh that replaces the cached guest with the registered user was fire-and-forget. When it failed the app kept treating a migrated account as a guest: the profile offered the upgrade again and sign-out still warned that the groups would be lost. A redeemed token under an anonymous session is proof the migration happened, so the account type is now corrected locally when the server copy cannot be fetched. The address catches up on the next refresh. Ending the session instead would undo what this flow guarantees. The existing test passed for the wrong reason: it left the fake's refreshAccount at its failing default, so it never covered the success path it claimed to.
They are stateless, so the getters allocated a new UiText on each access. Matches the sibling account screens.
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.
No description provided.