Fix for req session

This commit is contained in:
Akif9748 2022-09-10 21:02:24 +03:00
parent aa0bd09efd
commit c06af31f26
2 changed files with 4 additions and 3 deletions

View file

@ -20,8 +20,8 @@ But in front end, the API will works with session.
- GET `/api/bans/` fetch all bans. - GET `/api/bans/` fetch all bans.
- GET `/api/bans/:id` fetch a ban. - GET `/api/bans/:ip` fetch a ban.
- DELETE `/api/bans/:id` for unban an IP adress. - DELETE `/api/bans/:ip` for unban an IP adress.
- POST `/api/bans?reason=flood` for ban an IP adress. - POST `/api/bans?reason=flood` for ban an IP adress.

View file

@ -11,7 +11,8 @@ app.post("/", rateLimit({
windowMs: 24 * 60 * 60_000, max: 5, standardHeaders: true, legacyHeaders: false, windowMs: 24 * 60 * 60_000, max: 5, standardHeaders: true, legacyHeaders: false,
handler: (_r, response, _n, options) => response.error(options.statusCode, "You are begin ratelimited") handler: (_r, response, _n, options) => response.error(options.statusCode, "You are begin ratelimited")
}), async (req, res) => { }), async (req, res) => {
req.session.destroy()
req.session.userID=null;
let { username = null, password: body_pass = null, avatar, about } = req.body; let { username = null, password: body_pass = null, avatar, about } = req.body;