/** * Validates the not_in requirements. * @return boolean */ private function validateNotIn() { if (in_array($this->configuration->checkString(), $this->configuration->rules()->get(Plexity::RULE_NOT_IN))) { return false; } return true; }
<?php require_once '../vendor/autoload.php'; use Ballen\Plexity\Plexity as PasswordValidator; $password = new PasswordValidator(); $password->requireSpecialCharacters()->requireUpperCase()->requireLowerCase()->requireNumericChataters(3); // We want to ensure that the password uses atleast 3 numbers! // An example of passing a password history array, if the password exists in // here then we'll disallow it! $password->notIn(['piggy', 'people', 'mypasSwordh88e8*&|re']); try { $password->check('mypasSwordh88e8*&|re'); echo "Great news! The password passed validation!"; } catch (Ballen\Plexity\Exceptions\ValidationException $exception) { die('The validation failed, the error was: ' . $exception->getMessage()); }
public function testPasswordIsNotBetweenCharactersMaxFail() { $password = new Plexity(); $password->lengthBetween(1, 5); $this->setExpectedException('Ballen\\Plexity\\Exceptions\\ValidationException', 'The length exceeds the maximum length requirements.'); $password->check('An3akkkk'); }