fix for bug #1261: PostgreSQL: eGW ignores setting to dont care about case sensitive usernames

This commit is contained in:
Ralf Becker 2008-06-07 08:25:28 +00:00
parent 70e540d71b
commit bdf7f84a23

View File

@ -50,13 +50,20 @@ class auth_
function authenticate($username, $passwd, $passwd_type='text')
{
/* normal web form login */
$where = array(
'account_lid' => $username,
'account_type' => 'u',
'account_status' => 'A'
);
if (!$GLOBALS['egw_info']['server']['case_sensitive_username']) // = is case sensitiv eg. on postgres, but not on mysql!
{
$where[] = 'account_lid '.$this->db->capabilities[egw_db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote($username);
unset($where['account_lid']);
}
if($passwd_type == 'text')
{
if (!($row = $this->db->select($this->table,'account_lid,account_pwd,account_lastlogin',array(
'account_lid' => $username,
'account_type' => 'u',
'account_status' => 'A'
),__LINE__,__FILE__)->fetch()) || empty($row['account_pwd']) ||
if (!($row = $this->db->select($this->table,'account_lid,account_pwd,account_lastlogin',$where,__LINE__,__FILE__)->fetch()) ||
empty($row['account_pwd']) ||
$GLOBALS['egw_info']['server']['case_sensitive_username'] && $row['account_lid'] != $username)
{
return false;
@ -88,12 +95,8 @@ class auth_
/* Auth via crypted password. NOTE: mail needs cleartext password to authenticate against mailserver! */
else
{
if (!($row = $this->db->select($this->table,'account_lid,account_lastlogin',array(
'account_lid' => $username,
'account_type' => 'u',
'account_status' => 'A',
'account_pwd' => $passwd,
),__LINE__,__FILE__)->fetch()) ||
$where['account_pwd'] = $passwd;
if (!($row = $this->db->select($this->table,'account_lid,account_lastlogin',$where,__LINE__,__FILE__)->fetch()) ||
$GLOBALS['egw_info']['server']['case_sensitive_username'] && $row['account_lid'] != $username)
{
return false;