'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' export default function ForgotPasswordPage() { 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 (
Check your email We have sent a password reset link to your email address if it exists in our system.
) } return (
Forgot Password Enter your email address and we'll send you a link to reset your password.
Back to login
) }