final protected function _validateConsecutiveCharacterRepeat() {
        //validate that required indices exist
        if (!isset($this->_userProfile['username'])
            || !isset($this->_userProfile['password'])
            || !isset($this->_userProfile['fullname'])
            || !isset($this->_userProfile['passhist'])
        ) {
            throw new UserCredentialException('The username and password are not set', 1016);
        }

        //FOR CHARACTER REPETITION
        //determine which entropy to use (base or udf)
        $entropyObj = $this->_udfEntropySetting;
        $maxConsecutiveChars = (int) ($entropyObj['max_consecutive_chars']);
        
        //because we offset by -2 when doing regex, if the limit is not greater or equal to 2, default to 2
        if (!($maxConsecutiveChars >= 2)) {
            $maxConsecutiveChars = 2;
        }
        
        //offset for purposes of matching (TODO: fix?)
        $maxConsecutiveCharsRegexOffset = ++$maxConsecutiveChars - 2;
        
        //build regex
        $maxConsecutiveCharsRegex = '/' . $this->_regexBuildPattern(5, $maxConsecutiveCharsRegexOffset) . '/';
        $testVal = preg_match($maxConsecutiveCharsRegex,$this->_userProfile['password']);

        if ($testVal === false) {
            throw new UserCredentialException('A fatal error occured in the password validation', 1018);
        } elseif ($testVal == true) {
            throw new UserCredentialException('The password violates policy about consecutive character repetitions. '. $this->_getPasswordCharacterRepeatDescription(), \USERCREDENTIAL_ACCOUNTPOLICY_WEAKPASSWD);
        } else {/*Do nothing*/}
        
        //FOR CHARACTER CLASS REPETITION
        //determine which entropy to use (base or udf)
        $maxConsecutiveCharsSameClass = (int) ($entropyObj['max_consecutive_chars_of_same_class']);
        
        //because we offset by -2 when doing regex, if the limit is not greater or equal to 2, default to 2
        if (!($maxConsecutiveCharsSameClass >= 2)) {
            $maxConsecutiveCharsSameClass = 2;
        }
        
        //offset for purposes of matching (TODO: fix?)
        $maxConsecutiveCharsSameClassRegexOffset = ++$maxConsecutiveCharsSameClass;
        
        //build regex
        $maxConsecutiveCharsSameClassRegex = '/' . $this->_regexBuildPattern(6, $maxConsecutiveCharsSameClassRegexOffset) . '/';
        $testValSameClass = preg_match($maxConsecutiveCharsSameClassRegex,$this->_userProfile['password']);

        if ($testValSameClass === false) {
            throw new UserCredentialException('A fatal error occured in the password validation', 1018);
        } elseif ($testValSameClass == true) {
            throw new UserCredentialException('The password violates policy about consecutive repetition of characters of the same class. '. $this->_getPasswordCharacterClassRepeatDescription(), \USERCREDENTIAL_ACCOUNTPOLICY_WEAKPASSWD);
        } else {
            return true;
        }                
        
        return true;
    }
final protected function _validateConsecutiveCharacterRepeat() {
        //validate that required indices exist
        if (!isset($this->_userProfile['username'])
            || !isset($this->_userProfile['password'])
            || !isset($this->_userProfile['fullname'])
            || !isset($this->_userProfile['passhist'])
        ) {
            throw new UserCredentialException('The username and password are not set', 1016);
        }

        //FOR CHARACTER REPETITION
        //determine which entropy to use (base or udf)
        $entropyObj = $this->_udfEntropySetting;
        $maxConsecutiveChars = (int) ($entropyObj['max_consecutive_chars']);
        
        //because we offset by -2 when doing regex, if the limit is not greater or equal to 2, default to 2
        if (!($maxConsecutiveChars >= 2)) {
            $maxConsecutiveChars = 2;
        }
        
        //offset for purposes of matching (TODO: fix?)
        $maxConsecutiveCharsRegexOffset = ++$maxConsecutiveChars - 2;
        
        //build regex
        $maxConsecutiveCharsRegex = '/' . $this->_regexBuildPattern(5, $maxConsecutiveCharsRegexOffset) . '/';
        $testVal = preg_match($maxConsecutiveCharsRegex,$this->_userProfile['password']);

        if ($testVal === false) {
            throw new UserCredentialException('A fatal error occured in the password validation', 1018);
        } elseif ($testVal == true) {
            throw new UserCredentialException('The password violates policy about consecutive character repetitions. '. $this->_getPasswordCharacterRepeatDescription(), \USERCREDENTIAL_ACCOUNTPOLICY_WEAKPASSWD);
        } else {/*Do nothing*/}
        
        //FOR CHARACTER CLASS REPETITION
        //determine which entropy to use (base or udf)
        $maxConsecutiveCharsSameClass = (int) ($entropyObj['max_consecutive_chars_of_same_class']);
        
        //because we offset by -2 when doing regex, if the limit is not greater or equal to 2, default to 2
        if (!($maxConsecutiveCharsSameClass >= 2)) {
            $maxConsecutiveCharsSameClass = 2;
        }
        
        //offset for purposes of matching (TODO: fix?)
        $maxConsecutiveCharsSameClassRegexOffset = ++$maxConsecutiveCharsSameClass;
        
        //build regex
        $maxConsecutiveCharsSameClassRegex = '/' . $this->_regexBuildPattern(6, $maxConsecutiveCharsSameClassRegexOffset) . '/';
        $testValSameClass = preg_match($maxConsecutiveCharsSameClassRegex,$this->_userProfile['password']);

        if ($testValSameClass === false) {
            throw new UserCredentialException('A fatal error occured in the password validation', 1018);
        } elseif ($testValSameClass == true) {
            throw new UserCredentialException('The password violates policy about consecutive repetition of characters of the same class. '. $this->_getPasswordCharacterClassRepeatDescription(), \USERCREDENTIAL_ACCOUNTPOLICY_WEAKPASSWD);
        } else {
            return true;
        }                
        
        return true;
    }
final protected function _validateConsecutiveCharacterRepeat ( ) { //validate that required indices exist
 if ( ! isset ( $ this -> _userProfile [ 'username' ] ) || ! isset ( $ this -> _userProfile [ 'password' ] ) || ! isset ( $ this -> _userProfile [ 'fullname' ] ) || ! isset ( $ this -> _userProfile [ 'passhist' ] ) ) { throw new UserCredentialException ( 'The username and password are not set' , 1016 ) ; } //FOR CHARACTER REPETITION
 //determine which entropy to use (base or udf)
 $ entropyObj = $ this -> _udfEntropySetting ; $ maxConsecutiveChars = ( int ) ( $ entropyObj [ 'max_consecutive_chars' ] ) ; //because we offset by -2 when doing regex, if the limit is not greater or equal to 2, default to 2
 if ( ! ( $ maxConsecutiveChars >= 2 ) ) { $ maxConsecutiveChars = 2 ; } //offset for purposes of matching (TODO: fix?)
 $ maxConsecutiveCharsRegexOffset = ++ $ maxConsecutiveChars - 2 ; //build regex
 $ maxConsecutiveCharsRegex = '/' . $ this -> _regexBuildPattern ( 5 , $ maxConsecutiveCharsRegexOffset ) . '/' ; $ testVal = preg_match ( $ maxConsecutiveCharsRegex , $ this -> _userProfile [ 'password' ] ) ; if ( $ testVal === false ) { throw new UserCredentialException ( 'A fatal error occured in the password validation' , 1018 ) ; } elseif ( $ testVal == true ) { throw new UserCredentialException ( 'The password violates policy about consecutive character repetitions. ' . $ this -> _getPasswordCharacterRepeatDescription ( ) , \ USERCREDENTIAL_ACCOUNTPOLICY_WEAKPASSWD ) ; } else { /*Do nothing*/ } //FOR CHARACTER CLASS REPETITION
 //determine which entropy to use (base or udf)
 $ maxConsecutiveCharsSameClass = ( int ) ( $ entropyObj [ 'max_consecutive_chars_of_same_class' ] ) ; //because we offset by -2 when doing regex, if the limit is not greater or equal to 2, default to 2
 if ( ! ( $ maxConsecutiveCharsSameClass >= 2 ) ) { $ maxConsecutiveCharsSameClass = 2 ; } //offset for purposes of matching (TODO: fix?)
 $ maxConsecutiveCharsSameClassRegexOffset = ++ $ maxConsecutiveCharsSameClass ; //build regex
 $ maxConsecutiveCharsSameClassRegex = '/' . $ this -> _regexBuildPattern ( 6 , $ maxConsecutiveCharsSameClassRegexOffset ) . '/' ; $ testValSameClass = preg_match ( $ maxConsecutiveCharsSameClassRegex , $ this -> _userProfile [ 'password' ] ) ; if ( $ testValSameClass === false ) { throw new UserCredentialException ( 'A fatal error occured in the password validation' , 1018 ) ; } elseif ( $ testValSameClass == true ) { throw new UserCredentialException ( 'The password violates policy about consecutive repetition of characters of the same class. ' . $ this -> _getPasswordCharacterClassRepeatDescription ( ) , \ USERCREDENTIAL_ACCOUNTPOLICY_WEAKPASSWD ) ; } else { return true ; } return true ; }
validate that there are no instances of consecutive character repetitions beyond allowed number
in the users password string

Cyril Ogana <cogana@gmail.com>
2015-07-18

@return bool

@access protected
@final
validate that there are no instances of consecutive character repetitions beyond allowed number in the users password string