app.js
/**
 * Checks if user is logged in.
 */
Checks if user is logged in.
Checks if user is logged in .
function loginRequired(req, res, next) {
  if (req.session.user) {
    next();
  } else {
    req.session.returnUrl = req.url;
    req.flash('error', 'Morate se prvo ulogovati.');
    return res.redirect('/login');
  }
}
function loginRequired ( req , res , next ) { if ( req . session . user ) { next ( ) ; } else { req . session . returnUrl = req . url ; req . flash ( 'error' , 'Morate se prvo ulogovati.' ) ; return res . redirect ( '/login' ) ; } }
Checks if user is logged in.
Checks if user is logged in .