Initial Commit

This commit is contained in:
Wingysam 2018-11-20 14:19:58 -05:00
commit f54d97e4a9
30 changed files with 2532 additions and 0 deletions

8
middlewares/locals.js Normal file
View file

@ -0,0 +1,8 @@
const config = require('../config');
module.exports = (req, res, next) => {
res.locals.successes = req.flash('success');
res.locals.errors = req.flash('error');
res.locals.config = config;
res.locals.req = req;
next();
};

11
middlewares/verifyAuth.js Normal file
View file

@ -0,0 +1,11 @@
const config = require('../config');
module.exports = options => {
return (req, res, next) => {
options = options ? options : {};
if (req.isAuthenticated()) {
next();
} else {
res.redirect(options.failureRedirect || config.defaultFailureRedirect);
}
};
}