Repository navigation
Forgot password - #39
Merged
Merged
Conversation
A "Forgot password?" link on the sign-in form leads to /forgot-password, which asks the backend for a reset link with client: "desktop", so the emailed link is a nodea:///reset-password/<token> deep link back into the app. /reset-password/:token checks the link, sets the new password, and lands on sign in with the email filled in and a notice. The reset signs the account out everywhere, so a signed-in app signs out locally too. The password rule SignupPage checked moves to src/lib/validation.ts so both forms share it. Needs nodea-sh/nodea#343 (the /v1/password-reset endpoints).
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.
Adds forgot password to the desktop app. Depends on nodea-sh/nodea#343, which adds the backend endpoints and the web console pages. Merge and deploy that first.
What changes
/forgot-passwordand carries over the email already typed./forgot-passwordcallsPOST /v1/password-resetwithclient: "desktop". The backend then builds the emailed link fromDESKTOP_FRONTEND_BASE_URL(nodea://in production), so it is anodea:///reset-password/<token>deep link.main.rsalready forwards everynodea://URL andDeepLinkListenernavigates to its path. I updated that component's comment: it saidFRONTEND_BASE_URLisnodea://, but in production that variable is the web console./reset-password/:token:validatePasswordmoves fromSignupPagetosrc/lib/validation.tsso both forms share it.Testing
tsc && vite buildpasses.vitest: 32 passed.tests/forgot-password.spec.ts. It stubs the three/v1/password-resetroutes and runs outside demo mode, so it goes through the realsrc/lib/api.tsand checks the request bodies ({email, client: "desktop"}and{password}). It covers the full request and reset flow, a weak password and mismatched passwords being refused before anything is sent, and a dead link.nodea://link in a packaged build. Please check it by hand once #343 is deployed.