'use client' import { useState } from 'react' import Link from 'next/link' export default function ForgotPasswordPage() { const [email, setEmail] = useState('') const [loading, setLoading] = useState(false) const [submitted, setSubmitted] = useState(false) async function handleSubmit(e: React.FormEvent) { e.preventDefault() if (!email) return setLoading(true) await fetch('/api/auth/reset-request', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email }), }) setLoading(false) // Always show "check your email" regardless of response (silent for non-existent users) setSubmitted(true) } if (submitted) { return (
If an account exists for {email}, a password reset link has been sent.
Back to sign in