'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 (

Check your email

If an account exists for {email}, a password reset link has been sent.

Back to sign in
) } return (

Reset password

Enter your email and we'll send a reset link.

setEmail(e.target.value)} required autoComplete="email" className="border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500" />

Back to sign in

) }