function password_policy_constraint_digit_validate in Password Policy 6
Same name and namespace in other branches
- 7 constraints/constraint_digit.inc \password_policy_constraint_digit_validate()
Password validation.
1 call to password_policy_constraint_digit_validate()
File
- constraints/
constraint_digit.inc, line 28 - Password policy constraint callbacks.
Code
function password_policy_constraint_digit_validate($password, $constraint, $uid) {
$length = drupal_strlen($password);
$num = 0;
for ($i = 0; $i < $length; $i++) {
if (ctype_digit($password[$i])) {
$num++;
}
}
return $num >= $constraint;
}