Skip to content

Commit

Permalink
fix: Check session isConnected
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Jul 21, 2022
1 parent 38c6749 commit 5ae80eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/middleware/auth.js
Expand Up @@ -54,7 +54,11 @@ const verifyToken = (req, res, next) => {
req.session = formatSession(req.params.session);
req.token = tokenDecrypt;
req.client = clientsArray[req.session];
next();
if (!req.client || req.client.status === null) {
res.status(401).json({ error: 'Your session is not connected' });
} else {
next();
}
} else {
return res.status(401).json({ error: 'Check that the Session and Token are correct' });
}
Expand Down

0 comments on commit 5ae80eb

Please sign in to comment.