/** * 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 */}
{/* Theme Toggle */} ); if (message) { return (
{renderBackground()}

Check your email

{message}

Return to Login
); } return (
{renderBackground()} {/* Logo/Brand */}
DataVision Logo { (e.target as HTMLImageElement).src = '/logo.svg'; }} />
Data Vision

Recover your account access

{/* Card */}

Reset Password

Enter your email to receive a reset link

{/* Error Message */} {error && (

{error}

)}
setEmail(e.target.value)} required className="w-full px-5 py-3.5 rounded-xl transition-all focus:outline-none focus:ring-2 focus:ring-primary-500/50 glass-input" placeholder="you@example.com" />
← Back to login
); }