app.js
// route middleware to make sure a user is logged in
route middleware to make sure a user is logged in
route middleware to make sure a user is logged in
function isLoggedIn(req, res, next) {
  console.log("checking to see if they are authenticated!")
  res.locals.loggedIn = false
  if (req.isAuthenticated()){
    console.log("user has been Authenticated")
    res.locals.loggedIn = true
    return next();
  } else {
    console.log("user has not been authenticated...")
    res.redirect('/login');
  }
}
function isLoggedIn ( req , res , next ) { console . log ( "checking to see if they are authenticated!" ) res . locals . loggedIn = false if ( req . isAuthenticated ( ) ) { console . log ( "user has been Authenticated" ) res . locals . loggedIn = true return next ( ) ; } else { console . log ( "user has not been authenticated..." ) res . redirect ( '/login' ) ; } }
route middleware to make sure a user is logged in
route middleware to make sure a user is logged in
// if user is authenticated in the session, carry on