fix middlewares

This commit is contained in:
Shane C 2024-08-27 12:08:19 -04:00
parent 25941e0437
commit c973278b5a
Signed by: shane
GPG key ID: E46B5FEA35B22FF9

View file

@ -28,7 +28,7 @@ const beginRatelimiter = new RateLimiter('/login/begin', { limit: 10, timeframe:
const completeRatelimiter = new RateLimiter('/login/complete', { limit: 5, timeframe: 30 });
app.post('/login/begin',
(...args) => beginRatelimiter.execute(...args),
(_args) => beginRatelimiter.middleware(),
requireAuth({ noAuthOnly: true }),
async (req: Request, res: Response) => {
if (typeof await isAuthenticated(req) == 'string') return res.status(403).send({ error: 'You are already authenticated' });
@ -40,7 +40,7 @@ app.post('/login/begin',
});
app.post('/login/complete',
(...args) => completeRatelimiter.execute(...args),
(_args) => completeRatelimiter.middleware(),
requireAuth({ noAuthOnly: true }),
async (req: Request, res: Response) => {
const body = req.body as CompleteReqBody;