christmas/middlewares/verifyAuth.js

11 lines
286 B
JavaScript
Raw Normal View History

2018-11-20 11:19:58 -08:00
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);
}
};
}