function password_policy_constraint_digit_validate in Password Policy 7
Same name and namespace in other branches
- 6 constraints/constraint_digit.inc \password_policy_constraint_digit_validate()
Password validation.
1 call to password_policy_constraint_digit_validate()
- PasswordPolicyTestCase::testDigitConstraint in tests/
password_policy.test - Test digit constraint.
File
- constraints/
constraint_digit.inc, line 29 - Password policy constraint callbacks.
Code
function password_policy_constraint_digit_validate($password, $constraint, $account) {
$matches = array();
$count = preg_match_all('/[0-9]/', $password, $matches);
return $count >= $constraint;
}