You are here

public function PasswordPolicy::check in Password Policy 7.2

Checks password versus each of the policy's active constraints.

Parameters

string $password: Password.

object $account: User account.

Return value

array Failure messages for failed constraints.

File

includes/PasswordPolicy.inc, line 119
Contains PasswordPolicy.

Class

PasswordPolicy
Defines a class used for managing Password Policies.

Code

public function check($password, $account) {
  $errors = array();
  foreach ($this
    ->activeConstraints() as $constraint) {
    if (!$constraint
      ->check($password, $account)) {
      $errors = array_merge($errors, $constraint
        ->failMessages($password, $account));
    }
  }
  return $errors;
}