1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-09-21 18:21:36 +02:00

added deleted and disabled check for checkToken

This commit is contained in:
xnacly 2021-08-10 20:37:29 +02:00
parent 8bd0326f80
commit c9bc622f6d

View File

@ -10,7 +10,7 @@ export function checkToken(token: string, jwtSecret: string): Promise<any> {
const user = await UserModel.findOne(
{ id: decoded.id },
{ "user_data.valid_tokens_since": true, bot: true }
{ "user_data.valid_tokens_since": true, bot: true, disabled: true, deleted: true }
).exec();
if (!user) return rej("Invalid Token");
// we need to round it to seconds as it saved as seconds in jwt iat and valid_tokens_since is stored in milliseconds