import { useState } from 'react'; import { useForgotPassword } from '@imphnen-frontend-service/service'; import { Link, useNavigate } from 'react-router'; import { toast } from 'sonner'; import { Icon } from '@iconify/react'; import ThemeToggle from '../../../components/theme-toggle'; export default function ForgotPasswordPage() { const [email, setEmail] = useState(''); const [emailSent, setEmailSent] = useState(false); const navigate = useNavigate(); const forgotPasswordMutation = useForgotPassword(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!email) { toast.error('Please enter your email'); return; } try { await forgotPasswordMutation.mutateAsync({ email }); setEmailSent(true); toast.success('Password reset email sent! Check your inbox.'); } catch (err) { toast.error((err as Error).message || 'Failed to send reset email'); } }; if (emailSent) { return (

Check Your Email

We've sent a password reset link to {email}

Click the link in the email to reset your password. The link will expire in 1 hour.

); } return (

Forgot Password?

No worries, we'll send you reset instructions

setEmail(e.target.value)} placeholder="your@email.com" disabled={forgotPasswordMutation.isPending} className="bg-white dark:bg-gray-800 text-gray-900 dark:text-white w-full px-4 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:bg-gray-100 dark:disabled:bg-gray-700 disabled:cursor-not-allowed" required />
); }