You are here

class Length_Constraint in Password Policy 5

Hierarchy

Expanded class hierarchy of Length_Constraint

1 string reference to 'Length_Constraint'
PasswordPolicyTest::testConstraints in tests/password_policy.test

File

constraints/constraint_length.php, line 5

View source
class Length_Constraint extends Character_Constraint {
  function validate($plaintext_password, $user = NULL) {
    $len = strlen($plaintext_password);
    return $len >= $this->minimumConstraintValue;
  }
  function getDescription() {
    return t('Password must be longer than the specified minimum length.');
  }
  function getValidationErrorMessage() {
    return t('Password must be a minimum of %numChars %characters in length.', array(
      '%numChars' => $this->minimumConstraintValue,
      '%characters' => format_plural($this->minimumConstraintValue, t('character'), t('characters')),
    ));
  }

}

Members