Skip to content

Loosen the Research reset-code check to non-empty input - #1598

Merged
AnthonyRonning merged 1 commit into
masterfrom
fix/reset-code-validation
Nov 12, 2026
Merged

AnthonyRonning merged 1 commit into
masterfrom
fix/reset-code-validation

Conversation

@w3irdrobot

@w3irdrobot w3irdrobot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Addresses #1580. The backend half is in #1552, so this PR does not close the issue on its own.

Summary

  • The lowercase rejection described in Research password reset: reset-code regex is too strict (rejects lowercase) #1580 was already fixed on master by Recovery codes and seed-preserving password reset #1470, which removed the pattern attribute and uppercases the code on submit. This PR handles what was left.
  • The form still required ^[A-Z0-9]{8,32}$ after trimming only the ends, so a code with whitespace inside it was rejected. It now strips all whitespace, uppercases, and blocks only empty input. The backend is the validator; the form no longer guesses at the code's shape or length.
  • maxLength={32} is removed. It silently cut off a pasted 32-character code that carried stray leading or trailing whitespace.

Behavior to be aware of

Validation

In apps/maple-research/frontend through the pinned Nix shell:

  • bun test src/components/PasswordResetFlow.test.tsx: 37 pass, 0 fail
  • bun run typecheck: pass
  • eslint and prettier on the two changed files: clean

Not run: the full frontend test suite, or the form in a running app against a backend.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The form required ^[A-Z0-9]{8,32}$ after trimming the ends, so a code
with interior whitespace was rejected, and maxLength={32} silently cut
off a pasted 32-character code that carried stray whitespace.

Strip all whitespace, uppercase, and only block empty input. The backend
is the validator; the form no longer guesses at the code's shape.

Refs #1580

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Maple development preview: https://3e789ffa.maple-ca8.pages.dev

Commit: 6d25521dae424631e173921bac5f66c097efdc07

Uses development API, billing, flags and PCR configuration. Cloudflare Access applies.

@AnthonyRonning
AnthonyRonning merged commit bcca93e into master Nov 12, 2026
22 checks passed
@AnthonyRonning
AnthonyRonning deleted the fix/reset-code-validation branch November 12, 2026 23:42

This branch was successfully deployed

1 active deployment
pages-pr-1598 — 6d25521d Deployed Nov 12, 2026 by github-actions[bot]
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.

2 participants