signup: an unsolved anti-spam check submits the form and clears everything typed #162
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-web#162
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "%!s()"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
What happens
Submit the sign-up form without solving the anti-spam check. The form posts, the server rejects it,
and you land back on an empty form: username, email, account type and the accepted-terms tick are
all gone and have to be retyped.
Why
/api/signupanswers every outcome with a 303 back to/signup?status=…(
src/pages/api/signup.ts:67-73), and the re-rendered form echoes nothing — none of the fieldscarry a
valueorchecked(src/components/signup-form.astro:195-276). So the response is afresh, empty page.
/signupis alsono-store(src/pages/signup.astro:20-22), so pressing Backdoes not reliably restore what was typed either.
Every other control on the form has a native constraint (
required,pattern,type="email"), sothe browser blocks an incomplete submit before it leaves the page. The captcha is the only control
that does not — which is why it is the one that looks like it wipes the form.
Fix
cap-widgetis a form-associated custom element and already implements this. It setsvalueMissingvalidity when it carries therequiredattribute and has no token, and on theresulting
invalidevent it scrolls itself into view and flashes.requiredanddata-cap-i18n-required-label={t("signup.captcha.required")}to both<cap-widget>elements — the sign-up form (src/components/signup-form.astro:293) and there-issue form (
:175).signup.captcha.requiredstring in both languages(EN "Complete the anti-spam check before you continue." /
SV "Slutför antispam-kontrollen innan du fortsätter.").
everywhere and the flash is visual only. Add an always-rendered, initially hidden
<p id="signup-captcha-required" role="alert">inside.captcha, unhidden from aninvalidlistener in a bundled module script (
script-src 'self'already covers that pattern — see thefocus script at
src/components/signup-form.astro:350), and append its id to the wrapper'saria-describedby.Out of scope
Statuses decided on the server (
taken,ratelimited,error,nomail) still lose the typedvalues. Tracked separately.
Done when
message in the page language.
pnpm check,pnpm lintandpnpm lang-checkpass.Part of gitborg/gitborg-docs#69.
supernaut refererade till detta ärende från bitborg/bitborg-docs2026-08-02 12:32:47 +00:00