diff --git a/auth.js b/auth.js index 00fcd67..96559a3 100644 --- a/auth.js +++ b/auth.js @@ -72,7 +72,6 @@ function is(req, res, next) { req.headers.user = database_entry.data[0]; next(); }); - // req.headers.password = password; } else { next(); diff --git a/lookup.js b/lookup.js index 62ba5de..7553de8 100644 --- a/lookup.js +++ b/lookup.js @@ -21,7 +21,9 @@ function get(req, res, next, search) { next(); } else if (database_entry.length == 0) { - res.render('not_found', req); + require('./auth').is(req, res, function () { + res.render('not_found', req); + }); } else { req.match = database_entry; @@ -52,7 +54,9 @@ function list(req, res, next, list) { index.find({group: list}).toArray(function (err, database_entry) { if (err) {req.error = err; next();} else { - if (database_entry.length < 1) res.render('not_found', req); + if (database_entry.length < 1) require('./auth').is(req, res, function () { + res.render('not_found', req); + }); req.match = database_entry; next(); } diff --git a/resources/jade/search.jade b/resources/jade/search.jade index 9dc229e..5439ba7 100644 --- a/resources/jade/search.jade +++ b/resources/jade/search.jade @@ -1,5 +1,5 @@ //- search.jade form(method="post", action="/") - input.search(type="text", name="search", placeholder="Je naam, id, klassennaam, docentencode, lokaalcode", value=path.split('/')[1] == 'klassenlijst' && match ? 'Leerlingen van ' + match[0].group : match ? ((match.first_name || match.name || 'Meerdere mensen hun rooster') + '\'s rooster') : '') + input.search(type="text", name="search", placeholder="Je naam, id, klassennaam, docentencode, lokaalcode", value=path.split('/')[1] == 'klassenlijst' && match && match.length > 1 ? 'Leerlingen van ' + match[0].group : match ? ((match.first_name || match.name || 'Meerdere mensen hun rooster') + '\'s rooster') : '') input.search(type="submit", value="Zoeken")