Email verification flow (verify endpoint + login gating)

Open
#957 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript

Research direction

Start with the password-reset path in routes/auth.ts, since the issue offers it as the model for a document-backed token, and check how Better Auth is wired before choosing between the two. The issue leaves that choice open, so settle it with a maintainer first. Done means a verify endpoint that sets email_verified, a requireEmailVerification setting that defaults off, a rate-limited resend endpoint, and an E2E spec covering verification and gated login.

Written by the indexing model from the issue text.

Description

area: auth enhancement priority: P2 security

Follow-up to #956 (auth hardening review). Missing functionality.

Gap

We set auth_user.email_verified only on invitation-accept. There is no self-serve email verification flow and no option to gate login on a verified email.

Proposed

  • Issue a verification token on registration (Better Auth emailVerification / sendVerificationEmail, or a document-backed token like the password-reset path in routes/auth.ts).
  • GET /auth/verify?token=… endpoint → mark email_verified = 1, redirect with success.
  • Optional requireEmailVerification auth setting that rejects login for unverified users (configurable; default off to preserve current behavior).
  • Resend-verification endpoint (rate-limited, like request-password-reset).

Acceptance

  • Unverified user can complete verification via emailed link.
  • With gating enabled, unverified login is rejected; with it disabled, behavior is unchanged.
  • E2E spec (88+) covering verify happy-path + gated-login rejection.
Dominant language
TypeScript
Stars
1.8k
Forks
219
Avg merge
2d 21h
Merged PRs (30d)
67

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SonicJs-Org/sonicjs

All issues in SonicJs-Org/sonicjs

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.