diff --git a/inc/Principal.php b/inc/Principal.php index 6d4bcedb..3de691fe 100644 --- a/inc/Principal.php +++ b/inc/Principal.php @@ -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'; diff --git a/inc/auth-functions.php b/inc/auth-functions.php index 9d8a40ff..6ada2c2a 100644 --- a/inc/auth-functions.php +++ b/inc/auth-functions.php @@ -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);