auth.js 219 B

1234567891011121314
  1. 'use strict';
  2. /**
  3. * Login required middleware
  4. */
  5. function ensureAuthenticated(req, res, next) {
  6. if (req.isAuthenticated()) {
  7. next();
  8. } else {
  9. res.redirect('/login');
  10. }
  11. };
  12. module.exports = ensureAuthenticated;