"use client" import { useState } from "react" import Link from "next/link" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { requestPasswordReset } from "@/lib/auth-client" export function ForgotPasswordForm() { const [email, setEmail] = useState("") const [error, setError] = useState("") const [success, setSuccess] = useState(false) const [isPending, setIsPending] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError("") setIsPending(true) try { const result = await requestPasswordReset({ email, redirectTo: "/reset-password", }) if (result.error) { setError(result.error.message || "Failed to send reset email") } else { setSuccess(true) } } catch { setError("An unexpected error occurred") } finally { setIsPending(false) } } if (success) { return (
If an account exists with that email, a password reset link has been sent. Check your terminal for the reset URL.