'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import Link from 'next/link' import { toast } from 'sonner' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '@/components/ui/card' import { authAPI } from '@/lib/api' export default function ForgotPasswordPage() { const router = useRouter() const [email, setEmail] = useState('') const [isLoading, setIsLoading] = useState(false) const [emailSent, setEmailSent] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setIsLoading(true) try { await authAPI.forgotPassword(email) setEmailSent(true) toast.success('Check your email for password reset instructions') } catch (error: any) { console.error('Forgot password error:', error) // Show generic success message for security (prevent email enumeration) setEmailSent(true) toast.success('Check your email for password reset instructions') } finally { setIsLoading(false) } } return (
Email Sent!
If an account exists with {email}, you will receive password reset instructions shortly.
Didn't receive an email?