Add isAuthed to request objects
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
45d0e0a2c0
commit
12753d76a1
@ -13,12 +13,14 @@ module.exports = async function authCheck(req, res, next) {
|
||||
try {
|
||||
var result = await utils.isAuthed(uuid) || false;
|
||||
if (!result) {
|
||||
req.isAuthed = false;
|
||||
const err = new Error('Unauthorised');
|
||||
err.status = 401;
|
||||
log.out('authMiddlewares: Authentication attempted with incorrect key',
|
||||
'warn');
|
||||
return next(err);
|
||||
} else {
|
||||
req.isAuthed = true;
|
||||
log.out('authMiddlewares: User authenticated', 'dbug');
|
||||
return next();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user