From 8752942af0b238480ca3dacdb9adb76b742ef287 Mon Sep 17 00:00:00 2001 From: Damjan Savic Date: Sun, 25 Jan 2026 06:32:52 +0100 Subject: [PATCH] auto-claude: subtask-1-1 - Import and integrate rate limiting into LoginForm. - Added rateLimiter import from utils/rateLimiting - Integrated rate limiting check before auth attempt - Follows ContactForm.tsx pattern exactly - Checks isRateLimited() and throws error with time to reset --- src/components/auth/LoginForm.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/auth/LoginForm.tsx b/src/components/auth/LoginForm.tsx index fa8768d..6372229 100644 --- a/src/components/auth/LoginForm.tsx +++ b/src/components/auth/LoginForm.tsx @@ -5,6 +5,7 @@ import { useRouter } from 'next/navigation'; import { Lock, Loader2 } from 'lucide-react'; import { useTranslations, useLocale } from 'next-intl'; import { createClient } from '@/lib/supabase/client'; +import { rateLimiter } from '../../utils/rateLimiting'; export default function LoginForm() { const t = useTranslations('login'); @@ -21,6 +22,13 @@ export default function LoginForm() { setError(null); try { + // Check rate limiting + const clientIp = '127.0.0.1'; // In production, get this from the request + if (rateLimiter.isRateLimited(clientIp)) { + const timeToReset = Math.ceil(rateLimiter.getTimeToReset(clientIp) / 1000 / 60); + throw new Error(`Too many attempts. Please try again in ${timeToReset} minutes.`); + } + const supabase = createClient(); const { error } = await supabase.auth.signInWithPassword({ email,