You are here

function Character_Constraint::validate in Password Policy 5

Overrides Constraint::validate

2 methods override Character_Constraint::validate()
Digit_Placement_Constraint::validate in constraints/constraint_digit_placement.php
Length_Constraint::validate in constraints/constraint_length.php

File

constraints/constraint_character.php, line 8

Class

Character_Constraint

Code

function validate($plaintext_password, $user = NULL) {
  $len = strlen($plaintext_password);
  $numValid = 0;
  for ($i = 0; $i < $len; $i++) {
    $numValid = $this
      ->_charIsValid($plaintext_password[$i]) ? $numValid + 1 : $numValid;
  }
  return $numValid >= $this->minimumConstraintValue;
}