You are here

function password_policy_user_load in Password Policy 7

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

Implements hook_user_load().

File

./password_policy.module, line 231
Allows enforcing restrictions on user passwords by defining policies.

Code

function password_policy_user_load($users) {
  foreach ($users as $uid => $user) {
    $user->force_password_change = _password_policy_is_password_change_forced($uid);
    if (empty($user->force_password_change)) {
      $blocked = db_select('password_policy_expiration', 'p', array(
        'target' => 'slave',
      ))
        ->fields('p', array(
        'blocked',
      ))
        ->condition('uid', $user->uid)
        ->execute()
        ->fetchField();
      if (!empty($blocked)) {
        if ($blocked <= _password_policy_get_request_time()) {
          $user->force_password_change = 1;
        }
      }
    }
  }
}