diff --git a/app/forgot-password/page.tsx b/app/forgot-password/page.tsx new file mode 100644 index 0000000..ba3744a --- /dev/null +++ b/app/forgot-password/page.tsx @@ -0,0 +1,113 @@ +"use client"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { z } from "zod"; +import { Input } from "@/components/ui/Input"; +import Button from "@/components/Button"; +import { Card } from "@/components/ui/Card"; +import Link from "next/link"; +import { ROUTES } from "@/utils/constants"; +import toast from "react-hot-toast"; + +const forgotPasswordSchema = z.object({ + email: z.string().email("Email invalide"), +}); + +type ForgotPasswordFormData = z.infer; + +export default function ForgotPasswordPage() { + const [isSubmitting, setIsSubmitting] = useState(false); + const [emailSent, setEmailSent] = useState(false); + + const { + register, + handleSubmit, + formState: { errors }, + } = useForm({ + resolver: zodResolver(forgotPasswordSchema), + }); + + const onSubmit = async (data: ForgotPasswordFormData) => { + setIsSubmitting(true); + try { + // TODO: Implement password reset API call + console.log("Password reset requested for:", data.email); + + // Simulate API call + await new Promise(resolve => setTimeout(resolve, 1000)); + + setEmailSent(true); + toast.success("Email de réinitialisation envoyé !"); + } catch (error) { + console.error("Password reset error:", error); + toast.error("Erreur lors de l'envoi de l'email"); + } finally { + setIsSubmitting(false); + } + }; + + return ( +
+ +
+

+ Mot de passe oublié +

+

+ Entrez votre email pour recevoir un lien de réinitialisation +

+
+ + {!emailSent ? ( +
+ + + +
+ ) : ( +
+
+

+ Email envoyé ! +

+

+ Vérifiez votre boîte mail et suivez les instructions pour réinitialiser votre mot de passe. +

+ + + +
+ )} + +

+ Vous vous souvenez de votre mot de passe ?{" "} + + Se connecter + +

+
+
+ ); +} diff --git a/app/login/page.tsx b/app/login/page.tsx index 66dfefc..d5ec63c 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -92,8 +92,8 @@ export default function LoginPage() { }; return ( -
- +
+

Connexion