Commit 19fda968 authored by aohrvetpv's avatar aohrvetpv
Browse files

Issue #2442491 by AohRveTPV: Password change not forced when expired account unblocked

parent e85e8fa9
Loading
Loading
Loading
Loading
+7 −7
Changes for password_policy.module: 7 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -343,13 +343,7 @@ function password_policy_user_update(&$edit, $account, $category) {
  }

  if (isset($edit['status']) && $edit['status'] != $account->status && $edit['status'] == 1) {
    // Account is being unblocked.
    db_update('password_policy_expiration')
      ->fields(array(
        'unblocked' => time(),
      ))
      ->condition('uid', $account->uid)
      ->execute();
    _password_policy_unblock($account);
  }
}

@@ -1272,6 +1266,12 @@ function _password_policy_unblock($account) {
      ))
      ->condition('uid', $account->uid)
      ->execute();
    db_update('password_policy_force_change')
      ->fields(array(
         'force_change' => 1,
        ))
      ->condition('uid', $account->uid)
      ->execute();
    user_save($account, array('status' => 1));
    drupal_set_message(t('The user %name has been unblocked.', array('%name' => $account->name)));
  }
+1 −0
Changes for tests/password_policy_expiration.test: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ class PasswordExpiration extends DrupalWebTestCase {
    $this->drupalPost('user/login', $edit, t('Log in'));
    $this->assertNoText(t('The username !name has not been activated or is blocked.', array('!name' => $name1)), t('Account not blocked from logging in.'));
    $this->assertNoText(t('User login'), t('Check that login block is not shown, to verify user successfully logged in.'));
    $this->assertRaw(t('Your password has expired. You must change your password to proceed on the site.'), t('User forced to change password.'));

    // Change test user account's password.
    $pass1 = "bbbbbb";