You are here

function password_policy_user_load in Password Policy 7.2

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

Implements hook_user_load().

Adds password history to user. Used by past_password and expire plugins.

4 calls to password_policy_user_load()
PasswordPolicyExpire::init in plugins/item/expire.inc
Checks on init if the user password has expired.
password_policy_ajax_check in ./password_policy.module
AJAX callback to check password against applicable policies.
password_policy_delay_constraint in plugins/constraint/delay.inc
Constraint callback for delay constraint.
password_policy_past_passwords_count_constraint in plugins/constraint/past_passwords.inc
Constraint callback for password history constraint.

File

./password_policy.module, line 405
Enforces password policies.

Code

function password_policy_user_load($accounts) {

  // Insure all accounts have a history array.
  foreach ($accounts as $account) {
    $account->password_history = array();
  }
  $query = db_select('password_policy_history', 'p')
    ->condition('p.uid', array_keys($accounts))
    ->fields('p', array(
    'uid',
    'pass',
    'created',
    'is_generated',
  ))
    ->orderBy('hid', 'DESC');
  foreach ($query
    ->execute() as $record) {
    $accounts[$record->uid]->password_history[] = $record;
  }
}