A couple more places restricting numeric usernames.

This commit is contained in:
Andrew McMillan 2011-10-25 08:14:25 +13:00
parent cd7c141a85
commit 326b67bc26
2 changed files with 2 additions and 2 deletions

View File

@ -200,7 +200,7 @@ class Principal {
$sql .= 'FROM dav_principal WHERE ';
switch ( $type ) {
case 'username':
$sql .= 'lower(username)=lower(:param)';
$sql .= 'lower(username)=lower(text(:param))';
break;
case 'user_no':
$sql .= 'user_no=:param';

View File

@ -239,7 +239,7 @@ function UpdateUserFromExternal( &$usr ) {
if ( isset($usr->active) && ($usr->active === 'f' || $usr->active === false) ) return false;
if ( $type == 'INSERT' ) {
$qry = new AwlQuery( 'INSERT INTO principal( type_id, user_no, displayname, default_privileges) SELECT 1, user_no, fullname, :privs::INT::BIT(24) FROM usr WHERE username=:username',
$qry = new AwlQuery( 'INSERT INTO principal( type_id, user_no, displayname, default_privileges) SELECT 1, user_no, fullname, :privs::INT::BIT(24) FROM usr WHERE username=(text(:username))',
array( ':privs' => privilege_to_bits($c->default_privileges), ':username' => $usr->username) );
$qry->Exec('Login',__LINE__,__FILE__);
CreateHomeCalendar($usr->username);