You are here

function password_policy_user_insert in Password Policy 7

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

Implements hook_user_insert().

File

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

Code

function password_policy_user_insert(&$edit, $account, $category) {
  $force = isset($edit['force_password_change']) ? $edit['force_password_change'] : variable_get('password_policy_new_login_change', 0);
  db_insert('password_policy_force_change')
    ->fields(array(
    'uid' => $account->uid,
    'force_change' => $force,
  ))
    ->execute();
  if (!empty($edit['pass'])) {

    // New users do not yet have an uid during the validation step, but they do
    // have at this insert step.  Store their first password in the system for
    // use with the history constraint (if used).
    if ($account->uid) {
      _password_policy_store_password($account->uid, $edit['pass']);
    }
  }
}