routes/index.js
// checks for the password in the /config/app.json file if it's set
checks for the password in the /config/app.json file if it's set
checks for the password in the / config / app . json file if it ' s set
function checkLogin(req, res, next) {
    var passwordConf = req.nconf.app.get('app');
    if(passwordConf && passwordConf.hasOwnProperty("password")){
        if(req.path == "/login" || req.path == "/logout" || req.path == "/login_action"){
            next();
        }else{
            if (req.session.loggedIn) {
                next(); 
            } else {
                res.redirect(req.app_context + "/login");
            }
        }
    }else{
        next();
    }
}
function checkLogin ( req , res , next ) { var passwordConf = req . nconf . app . get ( 'app' ) ; if ( passwordConf && passwordConf . hasOwnProperty ( "password" ) ) { if ( req . path == "/login" || req . path == "/logout" || req . path == "/login_action" ) { next ( ) ; } else { if ( req . session . loggedIn ) { next ( ) ; } else { res . redirect ( req . app_context + "/login" ) ; } } } else { next ( ) ; } }
checks for the password in the /config/app.json file if it's set
checks for the password in the / config / app . json file if it ' s set
// only check for login if a password is specified in the /config/app.json file // dont require login session for login route // if the session exists we continue, else renter login page // allow the next route to run // no password is set so we continue