Download & Extend

Account activation triggers both Account activation email and Password Recovery email

Project:Password policy
Version:6.x-1.0-alpha2
Component:Code
Category:bug report
Priority:critical
Assigned:afreeman
Status:closed (fixed)

Issue Summary

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

#1

Priority:normal» critical

#2

Has anyone looked at this?

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

#3

Status:active» needs review

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():

<?php
   
// 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.

AttachmentSize
password_policy_activation_mail.patch 1.77 KB

#4

Forgot to check status.

AttachmentSize
password_policy_activation_mail_.patch 1.79 KB

#5

subscribe

#6

Assigned to:Anonymous» afreeman

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

AttachmentSize
password_policy_activation_mail_2.patch 2.26 KB

#7

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.

#8

Status:needs review» needs work

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

#9

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

#10

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

AttachmentSize
password_policy_activation_mail_3.patch 1.03 KB

#11

Status:needs work» needs review

#12

Status:needs review» fixed

#13

Status:fixed» closed (fixed)

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

nobody click here