christmas/middlewares/verifyAuth.js
2018-11-20 14:19:58 -05:00

11 lines
No EOL
286 B
JavaScript

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);
}
};
}