Password recovery
For Admin panel only projects, the login is /, the home page is /dashboard, and other panel pages omit the /admin prefix. The proxy matches /dashboard/:path*, /users/:path* and /settings/:path*. Components use @/components and @/components/ui. API endpoints such as /api/admin/users/export keep their paths. Examples below use the combined public website + admin panel layout; generated standalone guides use the app’s actual paths.
Password recovery and email
1. Configure Resend
Add these values to .env.local and each deployment environment:
RESEND_API_KEY=your-resend-api-key
EMAIL_FROM="My App <accounts@example.com>"
Use a sender domain verified in Resend. Keep the API key server-side.
Sign-in and builds work without these values. Password recovery needs them to deliver email.
2. Request a reset
- Open
/admin/forgot-password. - Enter the account’s email address and submit.
- Open the emailed link and choose a new password.
- Return to
/adminand sign in.
The same confirmation appears for existing and unknown emails. A successful request does not confirm delivery; check server errors and Resend delivery events when troubleshooting.
Reset links are single-use and expire after one hour. A successful reset revokes existing sessions, clears private query data, and removes the token from the address bar.
3. Customize the email
| File | Purpose |
|---|---|
src/emails/reset-password-email.tsx |
Content, layout, and email-safe color palette |
src/emails/components/email-header.tsx |
Shared email header |
src/components/logo-iso.tsx |
Logo source used by the app and email PNG |
src/lib/email.ts |
HTML/plain-text rendering and Resend delivery |
Reuse EmailHeader for other templates. Its image URL needs an absolute public app origin reachable by email clients. Replace the shared logo and redeploy to update the branding.
The email palette is independent of the site’s CSS variables. Customize the template’s colors object directly.
Recovery safeguards
- Send Better Auth’s supplied reset URL unchanged. Keep tokens, URLs, and email payloads out of logs and analytics.
- Keep the generated origin validation, sanitized auth logger, and rate limits enabled.
- Keep recovery pages unindexed with
no-referrer. - Align client password limits with Better Auth when changing them.
Email delivery uses a ten-second request timeout and Next.js background tasks attached to the request lifecycle. Before scaling across instances, configure shared rate limits or suitable deployment limits.
References: Better Auth recovery, Resend API, React Email rendering.