- fix: refresh token, codice di errore ...

This commit is contained in:
Surya Paolo
2025-03-15 14:52:33 +01:00
parent 7d845355a9
commit a03c4cf613
5 changed files with 9 additions and 6 deletions

View File

@@ -22,7 +22,7 @@ const authenticateMiddleware = async (req, res, next, withUser = false, lean = f
req.token = null;
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
console.log(` ## ${logPrefix}_TOKEN INVALIDO ❌ ...`);
return noError ? next() : res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
return noError ? next() : res.status(req.code).send();
}
const user = await User.findByToken(token, 'auth', false, withUser, lean);
@@ -54,7 +54,7 @@ const authenticateMiddleware = async (req, res, next, withUser = false, lean = f
req.user = null;
req.token = null;
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
noError ? next() : res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
noError ? next() : res.status(req.code).send();
}
};