示例#1
0
 public static function testStrongPassword($s_Password)
 {
     // Setting max passwd length to 72 to avoid DoS attacks
     Validators::isStringOfMinLength($s_Password, "password", 8);
     Validators::isStringOfMaxLength($s_Password, "password", 72);
     return true;
 }
示例#2
0
 /**
  * Enforces username requirements
  *
  * @param string $parameter
  * @param string $parameterName
  * @param boolean $required
  * @throws InvalidParameterException
  */
 public static function isValidUsername($parameter, $parameterName, $required = true)
 {
     $isPresent = self::throwIfNotPresent($parameter, $parameterName, $required);
     if ($isPresent && preg_match('/[^a-zA-Z0-9_.-]/', $parameter)) {
         throw new InvalidParameterException('parameterInvalidAlias', $parameterName);
     }
     Validators::isStringOfMinLength($parameter, $parameterName, 2);
 }