Files
accountkit/test
CatoandClaude Opus 5.5 e31a41ff6b feat(auth): the sign-in link's email also carries a code to type on the page (#70)
* feat(auth): the sign-in link's email also carries a code to type on the page

A sign-in link opens wherever the mail app opens it: often another browser,
or another device, than the one where the person asked. The same email now
carries a six-digit code, typed on the page that asked for the link. It is
the same method (the address proven by mail), so it is free and needs no
third party: the owner asked for every free way in.

- Minted only with a sign-in link, only for a mailer with `codes: true`
  (createAuthMailer has it); the link request then answers { code: true } and
  SignInForm offers the field. A product with its own mailer changes nothing
  until it prints `extra.code`.
- Ten minutes, three tries, stored hashed; guessing spends the credential
  bucket. A second factor applies, answered as JSON like a password.
- better-auth's other email-code endpoints (a code on its own, reset by code,
  verification, email change) answer 404: recovery keeps its one path.
- Labels codePrompt and signInWithCode in all six languages.

Real-database tests (PGlite) cover sign-in, a code working once, three
wrong tries, the second factor, the closed endpoints and a mailer without
codes; the browser check covers the field at 320 and 390px in en and de.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

* build: commit dist for the sign-in code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 22:18:42 +01:00
..