diff --git a/src/pages/Register.tsx b/src/pages/Register.tsx index 9c042a7..1a625ef 100644 --- a/src/pages/Register.tsx +++ b/src/pages/Register.tsx @@ -8,6 +8,7 @@ export function Register() { const [email, setEmail] = useState('') const [pin, setPin] = useState('') const [password, setPassword] = useState('') + const [confirmPassword, setConfirmPassword] = useState('') const [error, setError] = useState('') const [loading, setLoading] = useState(false) const navigate = useNavigate() @@ -33,6 +34,10 @@ export function Register() { async function submitPin(e: React.FormEvent) { e.preventDefault() + if (password !== confirmPassword) { + setError('Passwords do not match') + return + } setLoading(true) setError('') try { @@ -110,11 +115,19 @@ export function Register() { placeholder="Choose a password (min 8 characters)" required autoComplete="new-password" style={input} /> + setConfirmPassword(e.target.value)} + placeholder="Confirm password" required autoComplete="new-password" + style={{ + ...input, + borderColor: confirmPassword && password !== confirmPassword ? 'var(--danger)' : undefined, + }} + /> {error &&

{error}

} -