'use client'; import React from 'react'; import { useForm } from 'react-hook-form'; import { toast } from 'sonner'; import { Button } from '@/components/ui/button'; import InputField from '@/components/forms/InputField'; import FooterLink from '@/components/forms/FooterLink'; import OpenDevSocietyBranding from '@/components/OpenDevSocietyBranding'; import { requestPasswordResetEmail } from '@/lib/actions/auth.actions'; type ForgotPasswordFormData = { email: string; }; const ForgotPasswordPage = () => { const { register, handleSubmit, formState: { errors, isSubmitting }, } = useForm({ defaultValues: { email: '', }, mode: 'onBlur', }); const onSubmit = async (data: ForgotPasswordFormData) => { const result = await requestPasswordResetEmail(data); if (result.success) { toast.success('If an account exists for that email, a reset link has been sent.'); return; } toast.error('Password reset unavailable', { description: result.error ?? 'Unable to start password reset.', }); }; return ( <>

Forgot your password?

Enter your email address and we'll send you a password reset link.

); }; export default ForgotPasswordPage;