'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 (
{/* Logo */}
Website Monitor
Reset Password {emailSent ? 'Check your email for instructions' : 'Enter your email to receive password reset instructions'} {!emailSent ? (
setEmail(e.target.value)} placeholder="you@example.com" required disabled={isLoading} />
Back to Login
) : (

Email Sent!

If an account exists with {email}, you will receive password reset instructions shortly.

{"Didn't receive an email?"}

  • Check your spam folder
  • Make sure you entered the correct email
  • Wait a few minutes and try again
Back to Login
)}
) }