mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 01:56:12 +01:00
breaking: remove deprecated user middlewares
This commit is contained in:
@@ -82,18 +82,6 @@ module.exports = function (middleware) {
|
|||||||
return !res.headersSent;
|
return !res.headersSent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove in v1.19.0
|
|
||||||
middleware.authenticate = helpers.try(async (req, res, next) => {
|
|
||||||
winston.warn(`[middleware] middleware.authenticate has been deprecated, page and API routes are now automatically authenticated via setup(Page|API)Route. Use middleware.authenticateRequest (if not using route helper) and middleware.ensureLoggedIn instead. (request path: ${req.path})`);
|
|
||||||
if (!await authenticate(req, res)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!req.loggedIn) {
|
|
||||||
return controllers.helpers.notAllowed(req, res);
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
middleware.authenticateRequest = helpers.try(async (req, res, next) => {
|
middleware.authenticateRequest = helpers.try(async (req, res, next) => {
|
||||||
if (!await authenticate(req, res)) {
|
if (!await authenticate(req, res)) {
|
||||||
return;
|
return;
|
||||||
@@ -101,12 +89,6 @@ module.exports = function (middleware) {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Remove in v1.19.0
|
|
||||||
middleware.authenticateOrGuest = (req, res, next) => {
|
|
||||||
winston.warn(`[middleware] middleware.authenticateOrGuest has been renamed, use middleware.authenticateRequest instead. (request path: ${req.path})`);
|
|
||||||
middleware.authenticateRequest(req, res, next);
|
|
||||||
};
|
|
||||||
|
|
||||||
middleware.ensureSelfOrGlobalPrivilege = helpers.try(async (req, res, next) => {
|
middleware.ensureSelfOrGlobalPrivilege = helpers.try(async (req, res, next) => {
|
||||||
await ensureSelfOrMethod(user.isAdminOrGlobalMod, req, res, next);
|
await ensureSelfOrMethod(user.isAdminOrGlobalMod, req, res, next);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user