"use client"; import { cn } from "@/lib/utils"; import { resetPassword } from "@/lib/actions/auth"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import Link from "next/link"; import { useState } from "react"; export function ForgotPasswordForm({ className, ...props }: React.ComponentPropsWithoutRef<"div">) { const [email, setEmail] = useState(""); const [error, setError] = useState(null); const [success, setSuccess] = useState(false); const [isLoading, setIsLoading] = useState(false); const handleForgotPassword = async (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); setError(null); try { const res = await resetPassword(email); if (res.success) { setSuccess(true); } else { setError(res.error || "Ein Fehler ist aufgetreten."); } } catch (error: unknown) { setError(error instanceof Error ? error.message : "Ein Fehler ist aufgetreten."); } finally { setIsLoading(false); } }; return (
{success ? ( E-Mails prüfen Link zum Zurücksetzen gesendet

Wenn Sie sich mit E-Mail und Passwort registriert haben, erhalten Sie in Kürze eine E-Mail zum Zurücksetzen Ihres Passworts.

) : ( Passwort zurücksetzen Geben Sie Ihre E-Mail-Adresse ein. Wir senden Ihnen einen Link, um Ihr Passwort zurückzusetzen.
setEmail(e.target.value)} />
{error &&

{error}

}
Bereits ein Konto vorhanden?{" "} Anmelden
)}
); }