Merge "Allow false as return type of FileBackendStore::doGetFileXAttributes"
[lhc/web/wiklou.git] / includes / auth / LocalPasswordPrimaryAuthenticationProvider.php
index 047a811..7d02a82 100644 (file)
@@ -199,7 +199,7 @@ class LocalPasswordPrimaryAuthenticationProvider
                list( $db, $options ) = \DBAccessObjectUtils::getDBOptions( $flags );
                return (bool)wfGetDB( $db )->selectField(
                        [ 'user' ],
-                       [ 'user_id' ],
+                       'user_id',
                        [ 'user_name' => $username ],
                        __METHOD__,
                        $options
@@ -303,18 +303,16 @@ class LocalPasswordPrimaryAuthenticationProvider
                }
 
                $req = AuthenticationRequest::getRequestByClass( $reqs, PasswordAuthenticationRequest::class );
-               if ( $req ) {
-                       if ( $req->username !== null && $req->password !== null ) {
-                               // Nothing we can do besides claim it, because the user isn't in
-                               // the DB yet
-                               if ( $req->username !== $user->getName() ) {
-                                       $req = clone $req;
-                                       $req->username = $user->getName();
-                               }
-                               $ret = AuthenticationResponse::newPass( $req->username );
-                               $ret->createRequest = $req;
-                               return $ret;
+               if ( $req && $req->username !== null && $req->password !== null ) {
+                       // Nothing we can do besides claim it, because the user isn't in
+                       // the DB yet
+                       if ( $req->username !== $user->getName() ) {
+                               $req = clone $req;
+                               $req->username = $user->getName();
                        }
+                       $ret = AuthenticationResponse::newPass( $req->username );
+                       $ret->createRequest = $req;
+                       return $ret;
                }
                return AuthenticationResponse::newAbstain();
        }