/** * Forgot Password Page - Styled to match Landing page * Allows users to request a password reset email * Uses custom backend endpoint for branded emails (avoids spam filters) */ import { useState } from 'react'; import { Link } from 'react-router-dom'; import { motion } from 'framer-motion'; import { useUserStore } from '../store/userStore'; import { Sun, Moon } from 'lucide-react'; import { api } from '../services/api'; export default function ForgotPassword() { const { isDark, toggleTheme } = useUserStore(); const [email, setEmail] = useState(''); const [loading, setLoading] = useState(false); const [message, setMessage] = useState(''); const [error, setError] = useState(''); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); setMessage(''); try { // Use custom backend endpoint for branded password reset emails // Uses our custom branded email service const response = await api.post('/api/v1/settings/auth/request-password-reset', { email: email.trim().toLowerCase() }); if (response.data.success) { setMessage('If an account exists with this email, you will receive a password reset link shortly. Please check your inbox and spam folder.'); } else { setError(response.data.message || 'Failed to send reset email'); } } catch (err: any) { // Don't reveal if email exists for security setMessage('If an account exists with this email, you will receive a password reset link shortly. Please check your inbox and spam folder.'); } finally { setLoading(false); } }; const renderBackground = () => ( <> {/* Background Orbs */}
{message}
Return to LoginRecover your account access
Enter your email to receive a reset link
{/* Error Message */} {error && ({error}