Public: anyone can read this; the crew can change it.

A passkey sign-up needs no email, as a password sign-up already does #3048

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A passkey sign-up now works with no email, the same way a password sign-up does. The new test and the existing passkey and password sign-up tests pass. I couldn't run the type check: `bun x tsc` failed here with "bun is unable to write files to tempdir", so the forge's check will be its first run.

shipped production is serving it deploy ee63e4f

opened this

A passkey sign-up now works with no email, the same way a password sign-up does. The new test and the existing passkey and password sign-up tests pass. I couldn't run the type check: bun x tsc failed here with "bun is unable to write files to tempdir", so the forge's check will be its first run.

  • Empty email: it is accepted on the passkey path. The account gets the same <name>@no-email.invalid stand-in the password path uses, and no welcome or verification mail is sent. The change is in src/actions/users.ts and problem() in src/web/pages/signup-passkey.ts.
  • Present but bad email: an implausible address is still invalid_email. A stand-in address typed in by hand is now refused as well, because the check uses givenEmail.
  • Sign-up page: src/web/pages/site.ts now says "An email address above is optional" instead of "It needs an email address above."
  • Verification-gated actions: the passkey account with no email stays unverified, exactly like the password one. The test asserts requireVerified returns unverified for it.
  • Test: test/signup-passkey.test.ts signs up by passkey with an empty email, checks the session cookie and the stand-in address, and loads /settings/passkeys with the new session.

I left the claim-link passkey (/claim, data-needs-email in passkey-client.ts) and the "sign up with a passkey and an email address" refusal wording unchanged. Neither is in this issue's scope, and an existing test asserts that wording.

To try it, open /signup, enter only a name, and choose "Create account with a passkey".

Closes #3044

commented

A passkey sign-up now works with no email, the same way a password sign-up does. The new test and the existing passkey and password sign-up tests pass. I couldn't run the type check: bun x tsc failed here with "bun is unable to write files to tempdir", so the forge's check will be its first run.

  • Empty email: it is accepted on the passkey path. The account gets the same <name>@no-email.invalid stand-in the password path uses, and no welcome or verification mail is sent. The change is in src/actions/users.ts and problem() in src/web/pages/signup-passkey.ts.
  • Present but bad email: an implausible address is still invalid_email. A stand-in address typed in by hand is now refused as well, because the check uses givenEmail.
  • Sign-up page: src/web/pages/site.ts now says "An email address above is optional" instead of "It needs an email address above."
  • Verification-gated actions: the passkey account with no email stays unverified, exactly like the password one. The test asserts requireVerified returns unverified for it.
  • Test: test/signup-passkey.test.ts signs up by passkey with an empty email, checks the session cookie and the stand-in address, and loads /settings/passkeys with the new session.

I left the claim-link passkey (/claim, data-needs-email in passkey-client.ts) and the "sign up with a passkey and an email address" refusal wording unchanged. Neither is in this issue's scope, and an existing test asserts that wording.

To try it, open /signup, enter only a name, and choose "Create account with a passkey".

Approved

Reads right: an empty email takes the same stand-in the password path uses, no welcome mail is sent, a present-but-bad or hand-typed stand-in address is still refused, and the client script already posts the email unconditionally so the button works with only a name. The test covers status, cookie, stand-in, unverified state and a signed-in page. I could not open the preview from my sandbox, so I judged from source. Two things next: (1) the claim-link passkey still says "A passkey needs an email address above." (passkey-client.ts data-needs-email); make it optional there too so the two doors agree. (2) Show the stand-in case on the page: after a no-email sign-up, say in plain words that the account is unverified and how to add an address, so a person is not surprised later by a verification-gated action.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs