|
|
@ -678,10 +678,16 @@ class rcmail
|
|
|
|
$username .= '@'.rcube_parse_host($config['username_domain']);
|
|
|
|
$username .= '@'.rcube_parse_host($config['username_domain']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Convert username to lowercase. If IMAP backend
|
|
|
|
|
|
|
|
// is case-insensitive we need to store always the same username (#1487113)
|
|
|
|
|
|
|
|
if ($config['login_lc']) {
|
|
|
|
|
|
|
|
$username = mb_strtolower($username);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// try to resolve email address from virtuser table
|
|
|
|
// try to resolve email address from virtuser table
|
|
|
|
if (strpos($username, '@'))
|
|
|
|
if (strpos($username, '@') && ($virtuser = rcube_user::email2user($username))) {
|
|
|
|
if ($virtuser = rcube_user::email2user($username))
|
|
|
|
|
|
|
|
$username = $virtuser;
|
|
|
|
$username = $virtuser;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Here we need IDNA ASCII
|
|
|
|
// Here we need IDNA ASCII
|
|
|
|
// Only rcube_contacts class is using domain names in Unicode
|
|
|
|
// Only rcube_contacts class is using domain names in Unicode
|
|
|
@ -704,9 +710,15 @@ class rcmail
|
|
|
|
if (!($imap_login = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl))) {
|
|
|
|
if (!($imap_login = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl))) {
|
|
|
|
// try with lowercase
|
|
|
|
// try with lowercase
|
|
|
|
$username_lc = mb_strtolower($username);
|
|
|
|
$username_lc = mb_strtolower($username);
|
|
|
|
if ($username_lc != $username && ($imap_login = $this->imap->connect($host, $username_lc, $pass, $imap_port, $imap_ssl)))
|
|
|
|
if ($username_lc != $username) {
|
|
|
|
|
|
|
|
// try to find user record again -> overwrite username
|
|
|
|
|
|
|
|
if (!$user && ($user = rcube_user::query($username_lc, $host)))
|
|
|
|
|
|
|
|
$username_lc = $user->data['username'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($imap_login = $this->imap->connect($host, $username_lc, $pass, $imap_port, $imap_ssl))
|
|
|
|
$username = $username_lc;
|
|
|
|
$username = $username_lc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// exit if IMAP login failed
|
|
|
|
// exit if IMAP login failed
|
|
|
|
if (!$imap_login)
|
|
|
|
if (!$imap_login)
|
|
|
|