Account activation triggers both Account activation email and Password Recovery email

tomho - October 15, 2009 - 18:34
Project:Password policy
Version:6.x-1.0-alpha2
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

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

#1

tomho - October 19, 2009 - 08:26
Priority:normal» critical

#2

tomho - October 21, 2009 - 21:54

Has anyone looked at this?

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

#3

tacituseu - October 25, 2009 - 09:54
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

tacituseu - October 25, 2009 - 11:39

Forgot to check status.

AttachmentSize
password_policy_activation_mail_.patch 1.79 KB
 
 

Drupal is a registered trademark of Dries Buytaert.