mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
if authenticate middleware is overridden by plugin, check for req.user and return notAllowed helper otherwise
/cc @LudwikJaniuk
This commit is contained in:
@@ -25,7 +25,17 @@ module.exports = function (middleware) {
|
|||||||
req: req,
|
req: req,
|
||||||
res: res,
|
res: res,
|
||||||
next: function (err) {
|
next: function (err) {
|
||||||
auth.setAuthVars(req, res, function () { next(err); });
|
if (err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
auth.setAuthVars(req, res, function () {
|
||||||
|
if (req.loggedIn && req.user && req.user.uid) {
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
|
controllers.helpers.notAllowed(req, res);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user