Better 404, and 404 on total-table if not logged
This commit is contained in:
parent
aa9ce199b0
commit
f34475d211
|
@ -1,3 +1,4 @@
|
|||
const config = require('settings/config');
|
||||
const cal = require('calendar');
|
||||
const redirectIfNotLogged = require('auth/views').redirectIfNotLogged;
|
||||
|
||||
|
@ -38,7 +39,20 @@ module.exports.total = redirectIfNotLogged('total', function(req, res, render) {
|
|||
render('total.pug');
|
||||
});
|
||||
|
||||
module.exports.totalTable = function(req, res, render) {
|
||||
module.exports.totalTable = function(req, res, render, next) {
|
||||
if (req.session.user === undefined) {
|
||||
res.status(404);
|
||||
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
|
||||
res.render(config.BASE_DIR + '/templates/404.pug', res.locals, function(err, result) {
|
||||
if (err)
|
||||
console.log(err);
|
||||
res.send(result);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
computeUserTable(req.session.user, (result) => {
|
||||
res.locals.courses = result.courses;
|
||||
res.locals.total = result.total;
|
||||
|
|
Loading…
Reference in New Issue