lib/vantage-auth-basic.js
function attempt() {
      connections[id].attempts++;
      if (connections[id].attempts > retry) {
        connections[id].attempts = 0;
        connections[id].deny++;
        self.log(chalk.yellow("Access denied: too many attempts."));
        callback("Access denied: too many attempts.", false);
        return;
      }
      if (connections[id].deny >= deny && unlockTime > 0) {
        setTimeout(function(){
          connections[id].deny = 0;
        }, unlockTime);
        connections[id].attempts = 0;
        self.log(chalk.yellow("Account locked out: too many login attempts."));
        callback("Account locked out: too many login attempts.", false);
        return;
      }
      gather(function(user, pass){
        user = search(user, pass, users);
        if (user) {
          connections[id].attempts = 0;
          connections[id].deny = 0;
          callback("Successfully Authenticated.", true);
        } else {
          state.pass = void 0;
          setTimeout(function(){
            if (connections[id].attempts <= retry) {
              self.log("Access denied.");
            }
            attempt();
          }, retryTime);
        }
      });
    }
function attempt() {
      connections[id].attempts++;
      if (connections[id].attempts > retry) {
        connections[id].attempts = 0;
        connections[id].deny++;
        self.log(chalk.yellow("Access denied: too many attempts."));
        callback("Access denied: too many attempts.", false);
        return;
      }
      if (connections[id].deny >= deny && unlockTime > 0) {
        setTimeout(function(){
          connections[id].deny = 0;
        }, unlockTime);
        connections[id].attempts = 0;
        self.log(chalk.yellow("Account locked out: too many login attempts."));
        callback("Account locked out: too many login attempts.", false);
        return;
      }
      gather(function(user, pass){
        user = search(user, pass, users);
        if (user) {
          connections[id].attempts = 0;
          connections[id].deny = 0;
          callback("Successfully Authenticated.", true);
        } else {
          state.pass = void 0;
          setTimeout(function(){
            if (connections[id].attempts <= retry) {
              self.log("Access denied.");
            }
            attempt();
          }, retryTime);
        }
      });
    }
function attempt ( ) { connections [ id ] . attempts ++ ; if ( connections [ id ] . attempts > retry ) { connections [ id ] . attempts = 0 ; connections [ id ] . deny ++ ; self . log ( chalk . yellow ( "Access denied: too many attempts." ) ) ; callback ( "Access denied: too many attempts." , false ) ; return ; } if ( connections [ id ] . deny >= deny && unlockTime > 0 ) { setTimeout ( function ( ) { connections [ id ] . deny = 0 ; } , unlockTime ) ; connections [ id ] . attempts = 0 ; self . log ( chalk . yellow ( "Account locked out: too many login attempts." ) ) ; callback ( "Account locked out: too many login attempts." , false ) ; return ; } gather ( function ( user , pass ) { user = search ( user , pass , users ) ; if ( user ) { connections [ id ] . attempts = 0 ; connections [ id ] . deny = 0 ; callback ( "Successfully Authenticated." , true ) ; } else { state . pass = void 0 ; setTimeout ( function ( ) { if ( connections [ id ] . attempts <= retry ) { self . log ( "Access denied." ) ; } attempt ( ) ; } , retryTime ) ; } } ) ; }
Authentication attempt logic, including adding up retry and deny counts, etc.
Authentication attempt logic including adding up retry and deny counts etc .