1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 16:19:26 +00:00

Lock down reports page to teachers only

This commit is contained in:
2022-04-22 02:42:23 +00:00
parent b6c66b8e16
commit 64c0da6716
2 changed files with 8 additions and 1 deletions

View File

@@ -7,6 +7,13 @@ const User = require('../lib/User');
const validator = require('../lib/validator');
router.all(/\/reports.*/, (req, res, next) => {
if (!req.session.userType === 'account')
return res.redirect('/admin');
next();
});
router.get('/reports', async (req, res) => {
const u = await new User(req.db, req.session.userId);
const classes = await u.getClasses();