When password policy module is installed, my drupal setup is sending off both Account activation email and password recovery email to new users who got their accounts set from "block" to "active" state.

Deleting the password rules i set in the password policy module did not fix it, once i uninstalled the module the behaviour goes back to normal.

Anyone know a quick fix?

Thanks,
Tom

Comments

tomho’s picture

Priority: Normal » Critical
tomho’s picture

Has anyone looked at this?

Seems like a really critical bug if it is triggering wrong emails.

tacituseu’s picture

Status: Active » Needs review
StatusFileSize
new1.77 KB

Confirmed, happens only when unblocked from /user/%/edit, doesn't when done via /admin/user/expired or bulk operations, the culprit is call to _password_policy_unblock() from op submit in hook_user(), which is redundant since in D6 there is following code in user_save():

    // Send emails after we have the new user object.
    if (isset($array['status']) && $array['status'] != $account->status) {
      // The user's status is changing; conditionally send notification email.
      $op = $array['status'] == 1 ? 'status_activated' : 'status_blocked';
      _user_mail_notify($op, $user);
    } 

Attached patch fixes that, also changed _password_policy_unblock() for consistency.

tacituseu’s picture

StatusFileSize
new1.79 KB

Forgot to check status.

bjcool’s picture

subscribe

afreeman’s picture

Assigned: Unassigned » afreeman
StatusFileSize
new2.26 KB

Rerolled to work with latest dev release, backed out change that removed password reset mail code from _password_policy_unblock()

tacituseu’s picture

You can't have both user_save($account, array('status' => 1)); and password reset mail code in _password_policy_unblock() as it would recreate this problem at /admin/user/expired.

deekayen’s picture

Status: Needs review » Needs work

Well I just committed #6, so please submit a fixed patch on what's in HEAD now.

tacituseu’s picture

Would like to know what was the reasoning behind afreeman's change first, was #4 causing any problems ?

afreeman’s picture

Imperfect understanding of what these mails represented and when they're typically sent. I get it now. #7 is accurate.

afreeman’s picture

Status: Needs work » Needs review
deekayen’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.