summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2007-09-11 09:53:41 +0000
committerthomascube <thomas@roundcube.net>2007-09-11 09:53:41 +0000
commit532844b67740c96396d668745f4c59f7ebec81b2 (patch)
tree81bc792e8e3357e43580f4c48843f4207a629e8e /program
parent4845a1ea952f4affda3546abd7dfa02d24fc818c (diff)
Resolve username from virtuser file before looking up in database
Diffstat (limited to 'program')
-rw-r--r--program/include/main.inc22
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;