diff options
author | thomascube <thomas@roundcube.net> | 2007-09-11 09:53:41 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2007-09-11 09:53:41 +0000 |
commit | 532844b67740c96396d668745f4c59f7ebec81b2 (patch) | |
tree | 81bc792e8e3357e43580f4c48843f4207a629e8e /program/include/main.inc | |
parent | 4845a1ea952f4affda3546abd7dfa02d24fc818c (diff) |
Resolve username from virtuser file before looking up in database
Diffstat (limited to 'program/include/main.inc')
-rw-r--r-- | program/include/main.inc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 854458a64..ee6d19ba8 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -580,17 +580,22 @@ function rcmail_login($user, $pass, $host=NULL) $user .= '@'.$CONFIG['username_domain']; } + // try to resolve email address from virtuser table + if (!empty($CONFIG['virtuser_file']) && strpos($user, '@')) + $user = rcmail_email2user($user); + // lowercase username if it's an e-mail address (#1484473) if (strpos($user, '@')) $user = strtolower($user); // query if user already registered - $sql_result = $DB->query("SELECT user_id, username, language, preferences - FROM ".get_table_name('users')." - WHERE mail_host=? AND (username=? OR alias=?)", - $host, - $user, - $user); + $sql_result = $DB->query( + "SELECT user_id, username, language, preferences + FROM ".get_table_name('users')." + WHERE mail_host=? AND (username=? OR alias=?)", + $host, + $user, + $user); // user already registered -> overwrite username if ($sql_arr = $DB->fetch_assoc($sql_result)) @@ -599,11 +604,6 @@ function rcmail_login($user, $pass, $host=NULL) $user = $sql_arr['username']; } - // try to resolve email address from virtuser table - if (!empty($CONFIG['virtuser_file']) && strpos($user, '@')) - $user = rcmail_email2user($user); - - // exit if IMAP login failed if (!($imap_login = $IMAP->connect($host, $user, $pass, $imap_port, $imap_ssl))) return FALSE; |