diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-09-26 15:06:55 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-09-26 15:06:55 +0000 |
| commit | 6a521b70efca09fd6c483b076e653f30bc235beb (patch) | |
| tree | 7e3cfdaa823971bc33d600d37d18b13d06c69830 /roundcubemail/program | |
| parent | bac575abf1b61f8d7e28eee97b7e87dc9704a4db (diff) | |
Only lower-case user name if first login attempt failed (#1486393) + fix test
git-svn-id: https://svn.roundcube.net/trunk@3994 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/include/rcmail.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/roundcubemail/program/include/rcmail.php b/roundcubemail/program/include/rcmail.php index f0cbdbf86..9fe9430bd 100644 --- a/roundcubemail/program/include/rcmail.php +++ b/roundcubemail/program/include/rcmail.php @@ -611,10 +611,6 @@ class rcmail if ($virtuser = rcube_user::email2user($username)) $username = $virtuser; - // lowercase username if it's an e-mail address (#1484473) - if (strpos($username, '@')) - $username = mb_strtolower($username); - // user already registered -> overwrite username if ($user = rcube_user::query($username, $host)) $username = $user->data['username']; @@ -622,8 +618,16 @@ class rcmail if (!$this->imap) $this->imap_init(); + // try IMAP login + if (!($imap_login = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl))) { + // lowercase username if it's an e-mail address (#1484473) + $username_lc = mb_strtolower($username); + if ($username_lc != $username && ($imap_login = $this->imap->connect($host, $username_lc, $pass, $imap_port, $imap_ssl))) + $username = $username_lc; + } + // exit if IMAP login failed - if (!($imap_login = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl))) + if (!$imap_login) return false; $this->set_imap_prop(); @@ -646,7 +650,7 @@ class rcmail else { raise_error(array( 'code' => 600, 'type' => 'php', - 'file' => __FILE__, 'line' => __LINE__, + 'file' => __FILE__, 'line' => __LINE__, 'message' => "Failed to create a user record. Maybe aborted by a plugin?" ), true, false); } |
