Disable the old conversion from Windows-1252 unless the wiki has $wgLegacyEncoding...
authorPlatonides <platonides@users.mediawiki.org>
Sat, 26 Feb 2011 22:30:41 +0000 (22:30 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Sat, 26 Feb 2011 22:30:41 +0000 (22:30 +0000)
Has been done since r6920 (code added in r4438).
Also skipping the hashing if the windows-1252 password is the same we already probed.
The function_exists is not needed, since in such case GlobalFunctions would make it a wrapper to Fallback::iconv()

RELEASE-NOTES
includes/User.php

index b74a8bd..7420e22 100644 (file)
@@ -42,6 +42,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   by the page, but $wgAllowUserJs is set to false.
 * Pure "Skin" class based custom skins are no longer supported, all custom skins
   should be put together using SkinTemplate and BaseTemplate or QuickTemplate.
+* The transliteration for passwords in case they were migrated from an old Latin-1
+  install (previous to MediaWiki 1.5) is now only done for wikis with 
+  $wgLegacyEncoding set.
 
 === New features in 1.18 ===
 * Added a special page, disabled by default, that allows users with the
index 4ae4042..20aa43e 100644 (file)
@@ -2794,7 +2794,7 @@ class User {
         * @return Boolean: True if the given password is correct, otherwise False.
         */
        function checkPassword( $password ) {
-               global $wgAuth;
+               global $wgAuth, $wgLegacyEncoding;
                $this->load();
 
                // Even though we stop people from creating passwords that
@@ -2817,11 +2817,13 @@ class User {
                }
                if ( self::comparePasswords( $this->mPassword, $password, $this->mId ) ) {
                        return true;
-               } elseif ( function_exists( 'iconv' ) ) {
+               } elseif ( $wgLegacyEncoding ) {
                        # Some wikis were converted from ISO 8859-1 to UTF-8, the passwords can't be converted
                        # Check for this with iconv
                        $cp1252Password = iconv( 'UTF-8', 'WINDOWS-1252//TRANSLIT', $password );
-                       if ( self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) ) {
+                       if ( $cp1252Password != $password && 
+                               self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) )
+                       {
                                return true;
                        }
                }