Locking down some paths not meant to be seen with url

This commit is contained in:
Kasper Rynning-Tønnesen
2018-02-28 14:25:33 +01:00
parent 9268db4bcc
commit 7b66575ea8
2 changed files with 18 additions and 0 deletions

View File

@@ -183,6 +183,14 @@ app.use('/logout', function(req, res) {
res.redirect('/login');
});
app.use('/assets/admin/authenticated', function(req, res, next) {
if(!req.isAuthenticated()) {
res.sendStatus(403);
return;
}
return next();
});
app.use('/assets', express.static(publicPath + '/assets'));
app.use('/', isLoggedIn, function(req, res) {

View File

@@ -86,6 +86,16 @@ app.use('/', ico_router);
app.use('/', api);
app.use('/', router);
app.use('/assets/js', function(req, res, next) {
res.sendStatus(403);
return;
});
app.use('/assets/admin', function(req, res, next) {
res.sendStatus(403);
return;
});
app.use('/assets', express.static(publicPath + '/assets'));
app.use(function (req, res, next) {