fix(auth): harden forgot-password for production Resend email#181
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR enhances the password reset flow with rate limiting on the forgot-password endpoint, adds email configuration validation at startup, updates environment documentation for production email setup, and refines post-reset redirect timing and logging behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
9401514 to
a273d72
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…livery Production deployment of forgot-password requires: - RESEND_API_KEY set in Vercel env vars - EMAIL_FROM set to an address on a verified custom domain in Resend (default onboarding@resend.dev is sandbox-only, sends only to account owner) - DNS records configured: SPF, DKIM, and optionally DMARC for the sender domain - NEXT_PUBLIC_APP_URL set to the production URL (used in reset link) Changes: - Add IP-based rate limiting (3 req/15min) to forgot-password endpoint - Log structured errors in production when email send fails (was silent) - Keep dev-mode console logging of reset token/URL for local testing - Reduce reset-password redirect delay from 3s to 1.5s (cookie already set) - Add startup validation warning if RESEND_API_KEY missing or EMAIL_FROM still uses sandbox @resend.dev domain - Document Resend production setup steps in .env.example Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a273d72 to
6629393
Compare
|
@seanhanca Do you need any help setting up the resend api key or dns records? |
Summary
The forgot-password / reset-password flow is fully implemented but won't work in Vercel production due to Resend email configuration gaps. This PR hardens the flow for production readiness.
RESEND_API_KEYis missing orEMAIL_FROMstill uses the sandbox@resend.devdomain.env.example(custom domain verification, DNS records, env vars)Required Vercel env vars for production
RESEND_API_KEYEMAIL_FROMNaaP <noreply@naap.io>) — the defaultonboarding@resend.devis sandbox-onlyNEXT_PUBLIC_APP_URLThe sender domain must have SPF, DKIM, and optionally DMARC DNS records configured in Resend.
Test plan
RESEND_API_KEY+ verified domain → verify email receivedRESEND_API_KEY→ verify structured error logged at startup and on send🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation