Skip to content

fix(auth): Create account button silently did nothing on invalid input - #31

Merged
implemented.stream (thanabartbb) merged 1 commit into
mainfrom
fix/signup-feedback
Oct 15, 2026
Merged

implemented.stream (thanabartbb) merged 1 commit into
mainfrom
fix/signup-feedback

Conversation

@thanabartbb

Copy link
Copy Markdown
Member

Root cause

The server-side sign-up works. On production (46d66baf) a real test sign-up returned 303 → /chat, wrangler tail showed event: registered, and the test account was deleted afterwards. The problem is on the client: /login relied on the browser's native constraint validation (required, type=email, minLength=10). When the email was invalid or the password was under 10 characters, the browser blocked the submit and showed only a native bubble:

  • the bubble is in English, e.g. "Please lengthen this text to 10 characters or more…";
  • it is easy to miss, and some in-app or mobile browsers don't show it at all.

No request is sent, so clicking "สร้างบัญชี DevStack" looks like it does nothing. In headless Chromium (iPhone 13, Pixel 7 and desktop), short-password and empty submits sent 0 requests and only set validationMessage.

Ruled out:

  • CSP: form-action 'self' covers the POST.
  • Middleware/API 404: /api/auth is a known prefix.
  • Origin check: passes.
  • Rate limit: not hit.
  • Overlays: nothing covers the button.
  • Hydration errors: no page errors.

Fix

  • noValidate, plus a client check that mirrors the server rules (valid email, password 10–200 characters).
  • A visible TH/EN role=alert message, and focus moves to the field with the problem.
  • A double submit is ignored, and pending resets on bfcache pageshow.

Tests

  • New tests/login-form.test.tsx: 4 of its 5 tests fail on the old component.
  • Node 20: lint, typecheck, all 372 tests pass.
  • Checked in a local browser (iPhone 13): a short password shows the Thai message with 0 POSTs, and valid input sends 1 POST.

Not caused by today's deploys: login-form.tsx and the password route are unchanged since before f5c15746, so a rollback would not help. Not deployed.

@codesandbox-ci

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit df7ba8d:

Sandbox Source
devstack-my-button Configuration

@thanabartbb
implemented.stream (thanabartbb) merged commit 803b20c into main Oct 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant