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 linkYour password has been updated.
Sign InEnter your new password