11 lines
286 B
JavaScript
11 lines
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);
|
||
|
}
|
||
|
};
|
||
|
}
|