fix: request authentication called twice in account routes

This commit is contained in:
Julian Lam
2021-03-08 14:47:33 -05:00
parent 7da061f0d7
commit e3b2c00db1
3 changed files with 12 additions and 7 deletions

View File

@@ -148,12 +148,12 @@ module.exports = function (middleware) {
middleware.checkAccountPermissions = helpers.try(async (req, res, next) => {
// This middleware ensures that only the requested user and admins can pass
if (!await authenticate(req, res)) {
return;
}
// This check if left behind for legacy purposes. Older plugins may call this middleware without ensureLoggedIn
if (!req.loggedIn) {
return controllers.helpers.notAllowed(req, res);
}
const uid = await user.getUidByUserslug(req.params.userslug);
let allowed = await privileges.users.canEdit(req.uid, uid);
if (allowed) {