Password: replace equals() with verify()
[lhc/web/wiklou.git] / includes / auth / LocalPasswordPrimaryAuthenticationProvider.php
index 86a6aae..e9adb7e 100644 (file)
@@ -120,12 +120,12 @@ class LocalPasswordPrimaryAuthenticationProvider
                }
 
                $pwhash = $this->getPassword( $row->user_password );
-               if ( !$pwhash->equals( $req->password ) ) {
+               if ( !$pwhash->verify( $req->password ) ) {
                        if ( $this->config->get( 'LegacyEncoding' ) ) {
                                // 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', $req->password );
-                               if ( $cp1252Password === $req->password || !$pwhash->equals( $cp1252Password ) ) {
+                               if ( $cp1252Password === $req->password || !$pwhash->verify( $cp1252Password ) ) {
                                        return $this->failResponse( $req );
                                }
                        } else {
@@ -136,7 +136,8 @@ class LocalPasswordPrimaryAuthenticationProvider
                // @codeCoverageIgnoreStart
                if ( $this->getPasswordFactory()->needsUpdate( $pwhash ) ) {
                        $newHash = $this->getPasswordFactory()->newFromPlaintext( $req->password );
-                       \DeferredUpdates::addCallableUpdate( function () use ( $newHash, $oldRow ) {
+                       $fname = __METHOD__;
+                       \DeferredUpdates::addCallableUpdate( function () use ( $newHash, $oldRow, $fname ) {
                                $dbw = wfGetDB( DB_MASTER );
                                $dbw->update(
                                        'user',
@@ -145,7 +146,7 @@ class LocalPasswordPrimaryAuthenticationProvider
                                                'user_id' => $oldRow->user_id,
                                                'user_password' => $oldRow->user_password
                                        ],
-                                       __METHOD__
+                                       $fname
                                );
                        } );
                }