You are here

function password_policy_constraint_letter_validate in Password Policy 6

Same name and namespace in other branches
  1. 7 constraints/constraint_letter.inc \password_policy_constraint_letter_validate()

Password validation.

1 call to password_policy_constraint_letter_validate()
PasswordPolicyTestCase::testLetterConstraint in tests/password_policy.test

File

constraints/constraint_letter.inc, line 28
Password policy constraint callbacks.

Code

function password_policy_constraint_letter_validate($password, $constraint, $uid) {
  $length = drupal_strlen($password);
  $num = 0;
  for ($i = 0; $i < $length; $i++) {
    if (ctype_alpha($password[$i])) {
      $num++;
    }
  }
  return $num >= $constraint;
}