[Svn] r3994 - in trunk/roundcubemail: . program/include tests

trac at roundcube.net trac at roundcube.net
Sun Sep 26 17:06:55 CEST 2010


Author: thomasb
Date: 2010-09-26 10:06:55 -0500 (Sun, 26 Sep 2010)
New Revision: 3994

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/include/rcmail.php
   trunk/roundcubemail/tests/modcss.php
Log:
Only lower-case user name if first login attempt failed (#1486393) + fix test

Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-09-26 11:17:03 UTC (rev 3993)
+++ trunk/roundcubemail/CHANGELOG	2010-09-26 15:06:55 UTC (rev 3994)
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Only lower-case user name if first login attempt failed (#1486393)
 - Make alias setting in squirrelmail_usercopy plugin configurable (patch by pommi, #1487007)
 - Prevent from saving a non-existing skin path in user prefs (#1486936)
 - Improve handling of single-part messages with bogus BODYSTRUCTURE (#1486898)

Modified: trunk/roundcubemail/program/include/rcmail.php
===================================================================
--- trunk/roundcubemail/program/include/rcmail.php	2010-09-26 11:17:03 UTC (rev 3993)
+++ trunk/roundcubemail/program/include/rcmail.php	2010-09-26 15:06:55 UTC (rev 3994)
@@ -611,10 +611,6 @@
       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 @@
     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 @@
       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);
       }

Modified: trunk/roundcubemail/tests/modcss.php
===================================================================
--- trunk/roundcubemail/tests/modcss.php	2010-09-26 11:17:03 UTC (rev 3993)
+++ trunk/roundcubemail/tests/modcss.php	2010-09-26 15:06:55 UTC (rev 3994)
@@ -18,7 +18,7 @@
     $css = file_get_contents(TESTS_DIR . 'src/valid.css');
     $mod = rcmail_mod_css_styles($css, 'rcmbody');
 
-    $this->assertPattern('/#rcmbody div.rcmBody\s+\{/', $mod, "Replace body style definition");
+    $this->assertPattern('/#rcmbody\s+\{/', $mod, "Replace body style definition");
     $this->assertPattern('/#rcmbody h1\s\{/', $mod, "Prefix tag styles (single)");
     $this->assertPattern('/#rcmbody h1, #rcmbody h2, #rcmbody h3, #rcmbody textarea\s+\{/', $mod, "Prefix tag styles (multiple)");
     $this->assertPattern('/#rcmbody \.noscript\s+\{/', $mod, "Prefix class styles");

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list