Use different varname for upgraded hash from original hash
authorBrian Wolff <bawolff+wn@gmail.com>
Tue, 15 Nov 2016 03:44:49 +0000 (03:44 +0000)
committerBrian Wolff <bawolff+wn@gmail.com>
Tue, 15 Nov 2016 03:53:38 +0000 (03:53 +0000)
I found this confusing when reading the code. This should have
identical logic but slightly clearer.

Change-Id: I4918c29bd5dca3642de7bb60219fc246299d952d

includes/auth/LocalPasswordPrimaryAuthenticationProvider.php

index 88df68d..24124a9 100644 (file)
@@ -132,12 +132,12 @@ class LocalPasswordPrimaryAuthenticationProvider
 
                // @codeCoverageIgnoreStart
                if ( $this->getPasswordFactory()->needsUpdate( $pwhash ) ) {
-                       $pwhash = $this->getPasswordFactory()->newFromPlaintext( $req->password );
-                       \DeferredUpdates::addCallableUpdate( function () use ( $pwhash, $oldRow ) {
+                       $newHash = $this->getPasswordFactory()->newFromPlaintext( $req->password );
+                       \DeferredUpdates::addCallableUpdate( function () use ( $newHash, $oldRow ) {
                                $dbw = wfGetDB( DB_MASTER );
                                $dbw->update(
                                        'user',
-                                       [ 'user_password' => $pwhash->toString() ],
+                                       [ 'user_password' => $newHash->toString() ],
                                        [
                                                'user_id' => $oldRow->user_id,
                                                'user_password' => $oldRow->user_password