Update: checkLogin

This commit is contained in:
Yûki VACHOT 2021-12-11 12:39:49 +01:00
parent d2194ee9ea
commit 49bef8ec5f

View file

@ -81,10 +81,11 @@ function checkLogin(req, res, role=null){
if(typeof req.cookies !== 'undefined'){
const session = getSession(req.cookies.SESSIONID);
const token = getToken(session);
console.log(token);
if(typeof token.email === 'undefined' ||
typeof token.email === -1 ||
token.email === -1 ||
typeof token.id === 'undefined' ||
typeof token.id === -1){
token.id === -1){
return sendError(res, 500, 102, "User not authenticated.");
} else {
token.midExp = new Date(token.midExp*1000);