import { useState, type FormEvent } from 'react' import { Link, Navigate } from 'react-router-dom' import { requestPasswordReset } from '../api/auth' import { useAuth } from '../context/AuthContext' import logo from '../assets/logo.png' import './LoginPage.css' export function ForgotPasswordPage() { const { user } = useAuth() const [email, setEmail] = useState('') const [submitting, setSubmitting] = useState(false) const [sent, setSent] = useState(false) if (user) return async function handleSubmit(e: FormEvent) { e.preventDefault() setSubmitting(true) try { await requestPasswordReset(email) } catch { // Fall through to the generic message regardless -- the request // itself never reveals whether the email is registered. } finally { setSubmitting(false) setSent(true) } } return (
DS Chat
{sent ? (

If an account exists for that email, a password reset link is on its way. The link expires in 15 minutes.

) : ( <>

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

)} Back to log in
) }