You are here

function password_policy_password_validate in Password Policy 6

Same name and namespace in other branches
  1. 7 password_policy.module \password_policy_password_validate()

Password save validate handler.

1 string reference to 'password_policy_password_validate'
password_policy_form_alter in ./password_policy.module
Implements hook_form_alter().

File

./password_policy.module, line 643
The password policy module allows you to enforce a specific level of password complexity for the user passwords on the system.

Code

function password_policy_password_validate($form, &$form_state) {
  $values = $form_state['values'];
  $account = isset($form['_account']['#value']) ? $form['_account']['#value'] : (object) array(
    'uid' => 0,
  );
  if (!empty($values['pass']) && !isset($values['auth_openid'])) {
    $error = _password_policy_constraint_validate($values['pass'], $account);
    if ($error) {
      form_set_error('pass', t('Your password has not met the following requirement(s):') . '<ul><li>' . implode('</li><li>', $error) . '</li></ul>');
    }
  }
}