Fixed locals middleware doing an auth check for assets, scripts and other static content.
the build was successful
the build was successful
This commit is contained in:
+11
-9
@@ -28,15 +28,17 @@ module.exports = (req, res, next) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.user) {
|
if (["/static/", "/hax/", "/assets/"].find(p => req.path.startsWith(p)) == null) {
|
||||||
res.locals.user = {
|
if (req.user) {
|
||||||
loggedIn: true,
|
res.locals.user = {
|
||||||
name: req.user._json.name,
|
loggedIn: true,
|
||||||
permissions: getPermissions(req.user._json.name),
|
name: req.user._json.name,
|
||||||
}
|
permissions: getPermissions(req.user._json.name),
|
||||||
} else {
|
}
|
||||||
res.locals.user = {
|
} else {
|
||||||
loggedIn: false,
|
res.locals.user = {
|
||||||
|
loggedIn: false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user