r20300 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20299‎ | r20300 | r20301 >
Date:19:31, 9 March 2007
Author:laner
Status:old
Tags:
Comment:
Adding setInternalPassword(), and changing the behavior of setPassword in User.php.
Adding a check into SpecialUserLogin's initUser() function to only set a password if authentication plugins allow it.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -1394,11 +1394,23 @@
13951395 $wgMinimalPasswordLength ) );
13961396 }
13971397 }
1398 -
 1398+
13991399 if( !$wgAuth->setPassword( $this, $str ) ) {
14001400 throw new PasswordError( wfMsg( 'externaldberror' ) );
14011401 }
14021402
 1403+ $this->setInternalPassword( $str );
 1404+
 1405+ return true;
 1406+ }
 1407+
 1408+ /**
 1409+ * Set the password and reset the random token no matter
 1410+ * what.
 1411+ *
 1412+ * @param string $str
 1413+ */
 1414+ function setInternalPassword( $str ) {
14031415 $this->load();
14041416 $this->setToken();
14051417
@@ -1410,10 +1422,7 @@
14111423 }
14121424 $this->mNewpassword = '';
14131425 $this->mNewpassTime = null;
1414 -
1415 - return true;
14161426 }
1417 -
14181427 /**
14191428 * Set the random token (used for persistent authentication)
14201429 * Called from loadDefaults() among other places.
Index: trunk/phase3/includes/SpecialUserlogin.php
@@ -301,13 +301,18 @@
302302 * @private
303303 */
304304 function initUser( $u ) {
 305+ global $wgAuth;
 306+
305307 $u->addToDatabase();
306 - $u->setPassword( $this->mPassword );
 308+
 309+ if ( $wgAuth->allowPasswordChange() ) {
 310+ $u->setPassword( $this->mPassword );
 311+ }
 312+
307313 $u->setEmail( $this->mEmail );
308314 $u->setRealName( $this->mRealName );
309315 $u->setToken();
310316
311 - global $wgAuth;
312317 $wgAuth->initUser( $u );
313318
314319 $u->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 );
Index: trunk/phase3/RELEASE-NOTES
@@ -261,8 +261,8 @@
262262 * Link from Special:log/protect to change protection form
263263 * Fix fallback implementation of mb_strlen so it works and isn't insanely
264264 slow for large strings, since it's used for page edit lengths
 265+* (bug 8815) Setting password in initUser() breaks LdapAuthentication plugin
265266
266 -
267267 == Languages updated ==
268268
269269 * Arabic (ar)