feat(register): pass email to verification code request with UX guards - #22
Merged
Merged
Conversation
added 6 commits
September 17, 2026 23:49
sendCode now forwards an optional email to POST /auth/send-verification-code; register requires it (server-side 400 validation) while login omits the field entirely to keep the existing payload contract. Email is validated as required in RegisterForm (schema, resend gating, label) and the e2e helper reads the type-scoped Redis key.
The login sendCode case now pins the exact api.post payload with toStrictEqual (which, unlike toHaveBeenCalledWith, distinguishes a present-but-undefined key from an absent one), and the register case is renamed to describe what it actually verifies. The e2e helper comment no longer claims login codes are delivered by SMS.
sendCode omits the email field for empty strings as well as undefined, matching RegisterForm's .min(1) validation and the backend's 400 rejection of empty register emails.
The countdown fired synchronously after dispatch, so a rejected request (duplicate email, cooldown, network error) still showed a 60s countdown and had to be inferred from the error banner. Await the sendCode thunk and start the countdown only on fulfilled, keeping the code input hidden and the countdown at 0 on failure. - RegisterPage: await dispatch(sendCode(...)) and gate setCountdown(60) on sendCode.fulfilled.match(result) - userSlice.test: assert rejected sendCode surfaces the backend business message in state.error with showCodeInput/codeSent false, and that fulfilled flips both flags
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.
Summary
POST /auth/send-verification-code(sendCode(phoneNumber, type, email?); email omitted from payload for login — stricttoStrictEqualguards).verification_code:{type}:{phone}) and new label.Test evidence
tsc --noEmit0 errors /lint:check0 errorsNotes
type="button"(pre-existing), diverged api-contract copies sync.