Skip to content

feat(auth): forgot/reset password flow - #23

Merged
Lingz450 merged 1 commit into
mainfrom
feat/forgot-password
Jun 24, 2026
Merged

feat(auth): forgot/reset password flow#23
Lingz450 merged 1 commit into
mainfrom
feat/forgot-password

Conversation

@Lingz450

Copy link
Copy Markdown
Collaborator

What

Adds a self-serve password reset flow on top of Neon Auth (Better Auth).

  • Sign-in form — new "Forgot your password?" link → /forgot-password
  • /forgot-password — email field → authClient.requestPasswordReset({ email, redirectTo: <origin>/reset-password }). Always shows the same neutral "check your inbox" confirmation, so it can't be used to enumerate which accounts exist.
  • /reset-password — reads the one-time ?token from the emailed link (useSearchParams, wrapped in Suspense), validates new password + confirmation, then authClient.resetPassword({ newPassword, token }). Handles missing/invalid token up front with a "request a new link" path.

All pages live in the public (marketing) route group alongside /login and /signup. The /api/auth proxy already rate-limits forget-password/reset-password.

Neon Console (already configured — no action needed)

  • Trusted domain https://petro-brain-web.vercel.app present; "Allow Localhost" on
  • Email + sign-in/sign-up enabled; shared email sender auth@mail.myneon.app active
  • App name "PetroBrain Web" shows in the email

Test

/login → "Forgot your password?" → enter a real account email → check inbox (peek spam first time) → click link → set new password on /reset-password → sign in.

Notes

  • Email currently sends from auth@mail.myneon.app. Branding it to a PetroBrain domain (via the Webhooks toggle → Resend) is optional follow-up.
  • tsc --noEmit and ESLint pass on the changed files.

🤖 Generated with Claude Code

Wire a self-serve password reset on top of Neon Auth (Better Auth):
- "Forgot your password?" link on the sign-in form
- /forgot-password: requestPasswordReset with redirectTo /reset-password;
  neutral "check your inbox" confirmation so it can't enumerate accounts
- /reset-password: reads the one-time ?token, validates + confirms the new
  password, resetPassword; handles missing/invalid token up front

All pages live in the public (marketing) group like /login; the proxy already
rate-limits forget-password/reset-password. Neon Console side (trusted domain,
shared email sender, email auth) already configured.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
petro-brain-web Ready Ready Preview, Comment Jun 24, 2026 8:25am

@Lingz450
Lingz450 merged commit e292652 into main Jun 24, 2026
8 checks passed
@Lingz450
Lingz450 deleted the feat/forgot-password branch June 24, 2026 08:47
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