"use client"; import { useState, Suspense } from "react"; import { Card, CardContent } from "~/components/ui/card"; import { Input } from "~/components/ui/input"; import { Button } from "~/components/ui/button"; import { Label } from "~/components/ui/label"; import { toast } from "sonner"; import { Logo } from "~/components/branding/logo"; import { LegalModal } from "~/components/ui/legal-modal"; import { Mail, ArrowRight, ArrowLeft, Shield, Clock, CheckCircle, } from "lucide-react"; function ForgotPasswordForm() { const [email, setEmail] = useState(""); const [loading, setLoading] = useState(false); const [sent, setSent] = useState(false); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setLoading(true); try { const response = await fetch("/api/auth/forgot-password", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ email }), }); const data = (await response.json()) as { error?: string }; if (response.ok) { setSent(true); toast.success("Password reset instructions sent to your email"); } else { toast.error(data.error ?? "Failed to send reset email"); } } catch { toast.error("An error occurred. Please try again."); } finally { setLoading(false); } } if (sent) { return (
We've sent password reset instructions to your email address. Follow the link to create a new password.
Look for an email from beenvoice with reset instructions
The reset link is valid for 24 hours only
Your account security is our top priority
Email sent successfully
Follow the instructions in your email to reset your password
No worries! Enter your email address and we'll send you instructions to reset your password.
We'll send a secure link to your email address
Reset your password in just a few clicks
Your account security is our top priority
Enter your email and we'll send you reset instructions
Check your spam folder
Sometimes our emails end up in spam or promotions folders