fix(resend): keep a rejected resend submission on the resend view #239

Sammanfogat
supernaut sammanfogade 4 incheckningar från work/140 in i main 2026-09-21 10:14:05 +00:00
Ägare

Posting a malformed username to the resend form redirected to ?status=input, and that status rendered the main sign-up form. The visitor was silently moved to a different task.

Root cause is wider than the title. resend-setup-link.ts reused the literal status strings captcha, error, input and ratelimited from signup.ts. Both endpoints redirect to the same page, so showResend could not tell a rejected resend from a rejected sign-up. All four fell through to the sign-up form, not just input.

Fix: the resend endpoint gets its own prefixed status values, and the list lives in one place so the form, the route and the step indicator cannot drift apart.

  • src/lib/resend.ts: RESEND_VIEW_STATUSES and isResendViewStatus().
  • src/pages/api/resend-setup-link.ts: Status derived from that list; the four redirects renamed. sent was already unique and is unchanged.
  • src/components/signup-form.astro: showResend uses isResendViewStatus(). Four error notices added, three reusing existing sign-up strings, one new. aria-invalid and aria-describedby wired on the resend identifier field and the resend captcha widget, mirroring the username field.
  • src/lib/signup-steps.ts: a rejected resend keeps step 2 current. The visitor never left it.
  • New string signup.resend.error.invalid in both languages.

Tests: isResendViewStatus coverage including proof it does not match sign-up's same-named statuses, step-indicator coverage for the rejected-resend statuses, and updated Location expectations in the route test.

Minor version bump: new user-facing copy in two languages.

Verified: pnpm lint, pnpm check, pnpm test (365 passed), pnpm lang-check all pass.

Closes #140

Posting a malformed username to the resend form redirected to `?status=input`, and that status rendered the main sign-up form. The visitor was silently moved to a different task. Root cause is wider than the title. `resend-setup-link.ts` reused the literal status strings `captcha`, `error`, `input` and `ratelimited` from `signup.ts`. Both endpoints redirect to the same page, so `showResend` could not tell a rejected resend from a rejected sign-up. All four fell through to the sign-up form, not just `input`. Fix: the resend endpoint gets its own prefixed status values, and the list lives in one place so the form, the route and the step indicator cannot drift apart. - `src/lib/resend.ts`: `RESEND_VIEW_STATUSES` and `isResendViewStatus()`. - `src/pages/api/resend-setup-link.ts`: `Status` derived from that list; the four redirects renamed. `sent` was already unique and is unchanged. - `src/components/signup-form.astro`: `showResend` uses `isResendViewStatus()`. Four error notices added, three reusing existing sign-up strings, one new. `aria-invalid` and `aria-describedby` wired on the resend identifier field and the resend captcha widget, mirroring the username field. - `src/lib/signup-steps.ts`: a rejected resend keeps step 2 current. The visitor never left it. - New string `signup.resend.error.invalid` in both languages. Tests: `isResendViewStatus` coverage including proof it does not match sign-up's same-named statuses, step-indicator coverage for the rejected-resend statuses, and updated `Location` expectations in the route test. Minor version bump: new user-facing copy in two languages. Verified: `pnpm lint`, `pnpm check`, `pnpm test` (365 passed), `pnpm lang-check` all pass. Closes #140
supernaut lade till 2 incheckningar 2026-09-20 22:29:02 +00:00
The resend endpoint reused "captcha"/"error"/"input"/"ratelimited" from
sign-up's own status set. Both redirect to the same page, so the form
could not tell which one to render and always fell back to the main
sign-up form (#140). Give the resend endpoint its own status values and
include them wherever the page decides to show the resend view or the
step indicator's "confirm" step.

Adds signup.resend.error.invalid (en/sv) for a malformed identifier.
chore(resend): trim status comments to the reason
En del kontroller misslyckades
ci / ci (pull_request) Failing after 20s
485dcfb217
supernaut lade till 1 incheckning 2026-09-20 22:37:43 +00:00
chore: drop the accidentally committed node_modules symlink
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m17s
9d410c0e19
supernaut lade till 1 incheckning 2026-09-21 10:10:58 +00:00
merge main into work/140
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m29s
ff55b872cb
supernaut sammanfogade incheckning 6270d783ea till main 2026-09-21 10:14:05 +00:00
supernaut tog bort grenen work/140 2026-09-21 10:14:06 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-web!239
Ingen beskrivning angiven.