import { useState } from 'react'; import { useNavigate, useSearchParams, Link } from 'react-router-dom'; import { useAuthStore } from '../../store/authStore'; import { Blocks, Lock, Eye, EyeOff, CheckCircle } from 'lucide-react'; export default function ResetPassword() { const [searchParams] = useSearchParams(); const token = searchParams.get('token') || ''; const [password, setPassword] = useState(''); const [confirmPassword, setConfirmPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); const [done, setDone] = useState(false); const [pwError, setPwError] = useState(''); const { resetPassword, loading, error } = useAuthStore(); const navigate = useNavigate(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setPwError(''); if (password !== confirmPassword) { setPwError('Passwords do not match'); return; } if (password.length < 8) { setPwError('Password must be at least 8 characters'); return; } try { await resetPassword(token, password); setDone(true); } catch {} }; if (!token) { return (

Invalid reset link.

Request new link
); } if (done) { return (

Password Reset Complete

Your password has been updated.

Sign In
); } return (
RealBlocks

Enter your new password

{(error || pwError) && (
{pwError || error}
)}
setPassword(e.target.value)} className="input pl-10 pr-10" placeholder="••••••••" required minLength={8} />
setConfirmPassword(e.target.value)} className="input pl-10" placeholder="••••••••" required />
); }