From eebc636e4d25f9dcc379537961bf69b13f6a6c41 Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Mon, 24 Mar 2025 15:33:54 +0100 Subject: [PATCH] backend: use 'ms' library for login limiter window duration --- backend/src/routes/auth.routes.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/routes/auth.routes.ts b/backend/src/routes/auth.routes.ts index 1266ebb..5079874 100644 --- a/backend/src/routes/auth.routes.ts +++ b/backend/src/routes/auth.routes.ts @@ -1,3 +1,4 @@ +import ms from 'ms'; import { Router } from 'express'; import bodyParser from 'body-parser'; import * as authCtrl from '../controllers/auth.controller.js'; @@ -10,7 +11,7 @@ export const authRouter = Router(); // Limit login attempts for avoiding brute force attacks const loginLimiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 min + windowMs: ms('15m'), limit: 5, message: 'Too many login attempts, please try again later' });