import { useState } from 'react'; import { Button } from '../ui/button'; import { Card, CardContent } from '../ui/card'; import { Input } from '../ui/input'; import { Label } from '../ui/label'; import { forgetPassword } from '../../lib/auth-client'; import { ArrowLeft } from 'lucide-react'; const logo = '/logo.png'; interface Props { onBack: () => void; } export function ForgotPassword({ onBack }: Props) { const [email, setEmail] = useState(''); const [sent, setSent] = useState(false); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setError(''); setLoading(true); const res = await forgetPassword({ email, redirectTo: `${window.location.origin}/reset-password`, }); setLoading(false); if (res.error) { setError(res.error.message || 'Something went wrong'); } else { setSent(true); } } return (
If an account exists for {email}, we've sent a password reset link.
Enter your email and we'll send you a reset link.