Skip to content

feat(auth): require email verification for new signups#191

Draft
jerryzhou196 wants to merge 1 commit into
mainfrom
feat/email-verification
Draft

feat(auth): require email verification for new signups#191
jerryzhou196 wants to merge 1 commit into
mainfrom
feat/email-verification

Conversation

@jerryzhou196

Copy link
Copy Markdown
Member

What

Adds email verification to the email/password signup flow, mirroring the existing password-reset machinery. New accounts are created unverified and cannot log in until they enter a 6-character code emailed to them.

Changes

  • Migration (1782094648000_email_verification): adds queue.email_verify (one pending code per user) with a sendmail_notify('email_verify') trigger, plus a verified column on secret.user_email. Existing accounts default to verified = TRUE so nobody is locked out.
  • Auth (flow/api/auth): register now inserts verified = FALSE, queues a code, and withholds the JWT. New POST /auth/email/verify (consumes code → marks verified → returns JWT) and POST /auth/email/verify/send (resend). login rejects unverified accounts with email_not_verified.
  • Mail worker (flow/email): new email_verify queue case, scan, item type, and template.
  • Error enums: email_not_verified, invalid_verify_key.

Notes

  • Social (Google/Facebook) logins are unaffected — they never touch secret.user_email.
  • The pre-existing flow/api/parse/pdf build needs the poppler system lib locally; unrelated to this change. Touched packages build/vet clean and go test ./email/format/ passes.

Pairs with the frontend PR (UWFlow/uwflow_frontend) that adds the code-entry step.

🤖 Generated with Claude Code

New email/password accounts now receive a 6-character code and must
verify before they can log in. Mirrors the existing password-reset
machinery:

- migration: queue.email_verify table + notify trigger, and a verified
  column on secret.user_email (existing accounts default to verified)
- register withholds the JWT and queues a code; login rejects unverified
  accounts; add /auth/email/verify and /auth/email/verify/send
- mail worker renders and sends the verification email

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread flow/api/main.go
"/auth/email/register",
serde.WithDbResponse(conn, auth.RegisterEmail, "email register"),
)
router.Post(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these endpoints protected. if so where?

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