"use client"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { client } from "@/lib/auth-client"; import { AlertCircle, ArrowLeft, CheckCircle2 } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; export default function Component() { const [email, setEmail] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); const [isSubmitted, setIsSubmitted] = useState(false); const [error, setError] = useState(""); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsSubmitting(true); setError(""); try { const res = await client.forgetPassword({ email, redirectTo: "/reset-password", }); setIsSubmitted(true); } catch (err) { setError("An error occurred. Please try again."); } finally { setIsSubmitting(false); } }; if (isSubmitted) { return ( Check your email We've sent a password reset link to your email. If you don't see the email, check your spam folder. setIsSubmitted(false)} > Back to reset password ); } return ( {/* Radial gradient for the container to give a faded look */} Forgot password Enter your email to reset your password Email setEmail(e.target.value)} required /> {error && ( {error} )} {isSubmitting ? "Sending..." : "Send reset link"} Back to sign in ); }