module.exports = { ensureAuthenticated: function(req, res, next) { if (req.session.isAuthenticated) { return next(); } req.flash('error_msg', 'Please login to access this page'); res.redirect('/auth/login'); } };