You are here

function password_policy_constraint_alphanumeric_validate in Password Policy 7

Same name and namespace in other branches
  1. 6 constraints/constraint_alphanumeric.inc \password_policy_constraint_alphanumeric_validate()

Password validation.

1 call to password_policy_constraint_alphanumeric_validate()
PasswordPolicyTestCase::testAlphanumericConstraint in tests/password_policy.test
Test alphanumeric constraint.

File

constraints/constraint_alphanumeric.inc, line 29
Password policy constraint callbacks.

Code

function password_policy_constraint_alphanumeric_validate($password, $constraint, $account) {
  $matches = array();
  $count = preg_match_all('/[a-z0-9]/i', $password, $matches);
  return $count >= $constraint;
}