menuserver/server/middle/checkAuth.js
Martin Donnelly a4ebf90586 Added new note type
Better authentication
2020-03-21 21:22:12 +00:00

16 lines
440 B
JavaScript

function checkAuth(req, res, next) {
if (!req.session.auth)
// res.send('You are not authorized to view this page');
res.redirect('/');
else {
res.header('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0');
next();
}
}
module.exports = checkAuth;
// https://stackoverflow.com/questions/7990890/how-to-implement-login-auth-in-node-js
// look aT JWT BIT AT BOTTOM