allowDuplicateHandles and allowEmptyPasswords

Lukas Kahwe Smith <[email protected]> Sun, 05 Feb 2006 10:11:11 +0100
Newsgroups gmane.comp.php.pear.liveuser
Message-ID <[email protected]>
Hi,

I was just alerted to the fact that there are some issues in 
allowEmptyPasswords. I noticed that its not implemented in the admin 
code and quickly implemented it.

But thinking about it I think we can drop these two options since they 
can be effectively handled through the Globals.php for auth and the 
overriding feature of the config array:

$GLOBALS['_LiveUser']['auth']['tables'] = array(
     'users' => array(
         'fields' => array(
             'auth_user_id' => 'seq',
             'handle' => 'unique',
             'passwd' => true,
         ),
     ),
);

Here we do not allow duplicate handles:
'handle' => 'unique',

Changing the definition to the following would just make sure the field 
is non empty
'handle' => true,

The same applies to the password field:
'passwd' => true,

Changing this to the following would not allow any null values:
'passwd' => false,

Note that this would in theory allow empty strings. I think we should 
therefore make the following change:
'field' => 'seq', // create a primary key with sequence on the field
'field' => 'string', // create a unique index on all fields with the 
same value
'field' => true, // make the field NOT NULL and do not allow empty 
strings (the latter is handled by the storage layer and not by the schema)
'field' => false, // make the field NOT NULL <- BC break
'field' => null, // make the field NULLable

So if you allow NULLs for your password you would need to do the following:
Changing this to the following would not allow any null values:
'passwd' => null,

regards,
Lukas