'use client' import { useState } from 'react' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card' import { forgotPassword } from '@/app/actions/auth-reset' import { toast } from 'sonner' import Link from 'next/link' import { useLanguage } from '@/lib/i18n' export default function ForgotPasswordPage() { const { t } = useLanguage() const [isSubmitting, setIsSubmitting] = useState(false) const [isDone, setIsSubmittingDone] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setIsSubmitting(true) const formData = new FormData(e.currentTarget) const result = await forgotPassword(formData.get('email') as string) setIsSubmitting(false) if (result.error) { toast.error(result.error) } else { setIsSubmittingDone(true) } } if (isDone) { return (
{t('auth.checkYourEmail')} {t('auth.resetEmailSent')}
) } return (
{t('auth.forgotPasswordTitle')} {t('auth.forgotPasswordDescription')}
{t('auth.backToLogin')}
) }