Adding setInternalPassword(), and changing the behavior of setPassword in User.php.
authorRyan Lane <laner@users.mediawiki.org>
Fri, 9 Mar 2007 19:31:52 +0000 (19:31 +0000)
committerRyan Lane <laner@users.mediawiki.org>
Fri, 9 Mar 2007 19:31:52 +0000 (19:31 +0000)
Adding a check into SpecialUserLogin's initUser() function to only set a password if authentication plugins allow it.

RELEASE-NOTES
includes/SpecialUserlogin.php
includes/User.php

index 33f896a..0432bbd 100644 (file)
@@ -261,7 +261,7 @@ lighter making things easier to read.
 * Link from Special:log/protect to change protection form
 * Fix fallback implementation of mb_strlen so it works and isn't insanely
   slow for large strings, since it's used for page edit lengths
-
+* (bug 8815) Setting password in initUser() breaks LdapAuthentication plugin
 
 == Languages updated ==
 
index 3787c5e..a34558f 100644 (file)
@@ -301,13 +301,18 @@ class LoginForm {
         * @private
         */
        function initUser( $u ) {
+               global $wgAuth;
+
                $u->addToDatabase();
-               $u->setPassword( $this->mPassword );
+
+               if ( $wgAuth->allowPasswordChange() ) {
+                       $u->setPassword( $this->mPassword );
+               }
+
                $u->setEmail( $this->mEmail );
                $u->setRealName( $this->mRealName );
                $u->setToken();
 
-               global $wgAuth;
                $wgAuth->initUser( $u );
 
                $u->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 );
index 119dbf2..c285bc8 100644 (file)
@@ -1394,11 +1394,23 @@ class User {
                                        $wgMinimalPasswordLength ) );
                        }
                }
-               
+
                if( !$wgAuth->setPassword( $this, $str ) ) {
                        throw new PasswordError( wfMsg( 'externaldberror' ) );
                }
                
+               $this->setInternalPassword( $str );
+
+               return true;
+       }
+
+       /**
+        * Set the password and reset the random token no matter
+        * what.
+        *
+        * @param string $str
+        */
+       function setInternalPassword( $str ) {
                $this->load();
                $this->setToken();
                
@@ -1410,10 +1422,7 @@ class User {
                }
                $this->mNewpassword = '';
                $this->mNewpassTime = null;
-               
-               return true;
        }
-
        /**
         * Set the random token (used for persistent authentication)
         * Called from loadDefaults() among other places.