need default password if none created

bobsawey - July 7, 2009 - 00:52
Project:userplus
Version:6.x-2.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:fixed
Description

it is my opinion that user_password() should be called in userplus.module to ensure a default password is created in the case one is not provided.

My userplus module has been modified in ways that don't fit the project, so I haven't attached a patch. I'll try to do so once I've removed unnecessary code from my copy of the module.

#1

davidhunt - October 8, 2009 - 03:34
Version:6.x-2.2» 6.x-2.3
Category:feature request» bug report
Status:needs work» needs review

+1 for this: still an issue in 2.3 and 2.x-dev, and it's so important that I feel it's actually a bug in the module - I created 3 accounts today and the email was sent with "password: !password" - bad form IMHO. Here's a patch based on 2.3 version.

AttachmentSize
userplus.module.patch 404 bytes

#2

nonzero - October 30, 2009 - 00:24

Use strlen instead in the rare case that the password is cast to a boolean false.

if (strlen($u['pass']) == 0) {
  $u['pass'] = user_password();
}

#3

marcp - November 17, 2009 - 00:40
Status:needs review» fixed

Thanks very much for this. I added a minor tweak so a default password gets created when the password field is filled with whitespace.

         // If they left the password field empty give them a random one.
         if (strlen(trim($u['pass'])) == 0) {
           $u['pass'] = user_password();
         }

 
 

Drupal is a registered trademark of Dries Buytaert.