Add timeout cleanup to password reset confirm page and improve accessibility attributes

- Added `useEffect` for proper timeout cleanup in `PasswordResetConfirmForm` to prevent memory leaks during unmount.
- Enhanced form accessibility by adding `aria-required` attributes to all required fields for better screen reader compatibility.
- Updated `IMPLEMENTATION_PLAN.md` to reflect completion of Password Reset Flow and associated quality metrics.
This commit is contained in:
Felipe Cardoso
2025-11-01 01:01:56 +01:00
parent 925950d58e
commit cc98a76e24
4 changed files with 78 additions and 32 deletions

View File

@@ -6,6 +6,7 @@
'use client';
import { useSearchParams, useRouter } from 'next/navigation';
import { useEffect, useRef } from 'react';
import { PasswordResetConfirmForm } from '@/components/auth/PasswordResetConfirmForm';
import { Alert } from '@/components/ui/alert';
import Link from 'next/link';
@@ -14,11 +15,21 @@ export default function PasswordResetConfirmPage() {
const searchParams = useSearchParams();
const router = useRouter();
const token = searchParams.get('token');
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
// Cleanup timeout on unmount
useEffect(() => {
return () => {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
};
}, []);
// Handle successful password reset
const handleSuccess = () => {
// Wait 3 seconds then redirect to login
setTimeout(() => {
timeoutRef.current = setTimeout(() => {
router.push('/login');
}, 3000);
};