"use client" import { useState } from "react" import { Lock, Loader2, ArrowLeft } from "lucide-react" import { authClient } from "@/lib/auth-client" import { forgotPasswordSchema, } from "@/lib/auth/validation" import Link from "next/link" import { useRouter } from "next/navigation" export default function ForgotPasswordForm() { const router = useRouter() const [email, setEmail] = useState("") const [error, setError] = useState("") const [isLoading, setIsLoading] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError("") const result = forgotPasswordSchema.safeParse({ email }) if (!result.success) { setError(result.error.issues[0].message) return } setIsLoading(true) const { error } = await authClient.emailOtp.requestPasswordReset({ email, }) setIsLoading(false) if (error) { setError( error.message || "Something went wrong. Please try again.", ) return } // Redirect to reset password page with email router.push(`/reset-password?email=${encodeURIComponent(email)}`) } return (

Forgot your password?

Enter your email and we'll send you a verification code to reset your password.

{error && (
{error}
)}
setEmail(e.target.value)} placeholder="you@example.com" className="w-full px-3 py-2.5 rounded-lg border border-white/10 bg-white/[0.03] text-[#ebe4f1] text-sm placeholder:text-[#ebe4f1]/40 outline-none focus:border-[#eb3779] focus:ring-2 focus:ring-[#eb3779]/50 transition-colors" />
Back to sign in ) }