1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 18:39:32 +00:00

Fixed validation middlewares so they they run against all HTTP request types

This commit is contained in:
2022-03-21 10:37:55 +00:00
parent a7808458f8
commit bd662661ee
3 changed files with 5 additions and 3 deletions

View File

@@ -107,7 +107,7 @@ router.post('/testTemplate/add', async (req, res) => {
return res.redirect('/admin/test/add');
});
router.get(/test\/(.{36})(\/.*)?/, async (req, res, next) => {
router.all(/test\/(.{36})(\/.*)?/, async (req, res, next) => {
let t;
try {
t = await new Test(req.params[0]);
@@ -126,6 +126,7 @@ router.get(/test\/(.{36})(\/.*)?/, async (req, res, next) => {
next();
});
router.get('/test/:id', async (req, res) => {
const t = await new Test(req.params.id);
const linkRoot = `/admin/test/${t.id}`;
@@ -140,6 +141,7 @@ router.get('/test/:id', async (req, res) => {
maxMark: t.template.maxMark,
reportsLink: `${linkRoot}/reports`,
deleteLink: `${linkRoot}/delete`,
userType: req.session.userType,
testResults: [ {
mark: 50,
percentage: 100,