'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import { updateUserPassword } from '@/lib/auth/client' export default function UpdatePasswordPage() { const router = useRouter() const [password, setPassword] = useState('') const [confirmPassword, setConfirmPassword] = useState('') const [loading, setLoading] = useState(false) const [error, setError] = useState('') const [success, setSuccess] = useState(false) async function handleUpdatePassword(e: React.FormEvent) { e.preventDefault() setError('') // Validation if (password !== confirmPassword) { setError('Wachtwoorden komen niet overeen') return } if (password.length < 8) { setError('Wachtwoord moet minimaal 8 tekens zijn') return } setLoading(true) try { await updateUserPassword(password) setSuccess(true) setTimeout(() => router.push('/login'), 2000) } catch (err: any) { setError(err.message || 'Er ging iets mis') } finally { setLoading(false) } } if (success) { return (

Wachtwoord Gewijzigd!

Je wordt doorgestuurd naar de login pagina...

) } return (

Nieuw Wachtwoord Instellen

Kies een sterk wachtwoord (minimaal 8 tekens).

{error && (
{error}
)}
setPassword(e.target.value)} placeholder="••••••••" required minLength={8} className="w-full px-4 py-2.5 border border-slate-300 rounded-lg focus:ring-2 focus:ring-teal-500 focus:border-teal-500" />
setConfirmPassword(e.target.value)} placeholder="••••••••" required minLength={8} className="w-full px-4 py-2.5 border border-slate-300 rounded-lg focus:ring-2 focus:ring-teal-500 focus:border-teal-500" />
) }