From 14c30beb493c5fb7c31030979caf2cbd52958eaf Mon Sep 17 00:00:00 2001 From: Shane C Date: Tue, 27 Aug 2024 12:12:40 -0400 Subject: [PATCH] fix middlewares --- api/src/routes/login.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/api/src/routes/login.ts b/api/src/routes/login.ts index fa2d26d..c637d03 100644 --- a/api/src/routes/login.ts +++ b/api/src/routes/login.ts @@ -24,12 +24,8 @@ class CompleteReqBody { code: string; } -const beginRatelimiter = new RateLimiter('/login/begin', { limit: 10, timeframe: 300 }); -const completeRatelimiter = new RateLimiter('/login/complete', { limit: 5, timeframe: 30 }); - app.post('/login/begin', - (_args) => beginRatelimiter.middleware(), - requireAuth({ noAuthOnly: true }), + (_args) => requireAuth({ noAuthOnly: true }), async (req: Request, res: Response) => { if (typeof await isAuthenticated(req) == 'string') return res.status(403).send({ error: 'You are already authenticated' }); const body = req.body as BeginReqBody; @@ -40,8 +36,7 @@ app.post('/login/begin', }); app.post('/login/complete', - (_args) => completeRatelimiter.middleware(), - requireAuth({ noAuthOnly: true }), + (_args) => requireAuth({ noAuthOnly: true }), async (req: Request, res: Response) => { const body = req.body as CompleteReqBody; if ((!body.user || typeof body.user != 'string') ||