fix middlewares
This commit is contained in:
parent
25941e0437
commit
c973278b5a
1 changed files with 3 additions and 3 deletions
|
@ -28,7 +28,7 @@ const beginRatelimiter = new RateLimiter('/login/begin', { limit: 10, timeframe:
|
||||||
const completeRatelimiter = new RateLimiter('/login/complete', { limit: 5, timeframe: 30 });
|
const completeRatelimiter = new RateLimiter('/login/complete', { limit: 5, timeframe: 30 });
|
||||||
|
|
||||||
app.post('/login/begin',
|
app.post('/login/begin',
|
||||||
(...args) => beginRatelimiter.execute(...args),
|
(_args) => beginRatelimiter.middleware(),
|
||||||
requireAuth({ noAuthOnly: true }),
|
requireAuth({ noAuthOnly: true }),
|
||||||
async (req: Request, res: Response) => {
|
async (req: Request, res: Response) => {
|
||||||
if (typeof await isAuthenticated(req) == 'string') return res.status(403).send({ error: 'You are already authenticated' });
|
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',
|
app.post('/login/complete',
|
||||||
(...args) => completeRatelimiter.execute(...args),
|
(_args) => completeRatelimiter.middleware(),
|
||||||
requireAuth({ noAuthOnly: true }),
|
requireAuth({ noAuthOnly: true }),
|
||||||
async (req: Request, res: Response) => {
|
async (req: Request, res: Response) => {
|
||||||
const body = req.body as CompleteReqBody;
|
const body = req.body as CompleteReqBody;
|
||||||
|
|
Loading…
Reference in a new issue