Skip to content

Commit

Permalink
User logout on ban
Browse files Browse the repository at this point in the history
  • Loading branch information
thesantatitan committed Nov 10, 2021
1 parent d87c542 commit 49c3957
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/validators/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ export default async function validate(req, res, next) {
return;
}

if(user.banned){
await prisma.session.delete({ where: { sid: req.sessionID } });
req.session.destroy(() => {
respond(res, req, 400, ERROR.ACCOUNT_BANNED, undefined);
});
return;
}

req.session.lastActive = currentTime;
req.user = user;

Expand Down

0 comments on commit 49c3957

Please sign in to comment.