@@ -228,10 +228,11 @@ private function getAdmin(string $user, string $password, ScannerServiceCallback
228228 $ response = $ this ->client ->post ($ this ->baseUrl . 'admin-auth/ ' , [
229229 'auth ' => [$ user , $ password ],
230230 ]);
231- $ callback ->onScanAdminResult ($ user , $ password , $ response ->getStatusCode () === 200 );
231+ $ body = (string ) $ response ->getBody ();
232+ $ callback ->onScanAdminResult ($ user , $ password , $ response ->getStatusCode () === 200 && $ body === 'Authorized ' );
232233 return ;
233234 } catch (GuzzleException $ e ) {
234- if ($ e ->getCode () === 401 ) {
235+ if ($ e ->getCode () === 401 || $ e -> getCode () === 403 ) {
235236 $ callback ->onScanAdminResult ($ user , $ password , false );
236237 return ;
237238 }
@@ -241,7 +242,8 @@ private function getAdmin(string $user, string $password, ScannerServiceCallback
241242 $ response = $ this ->client ->get ($ this ->baseUrl . 'admin/ ' , [
242243 'auth ' => [$ user , $ password ],
243244 ]);
244- $ callback ->onScanAdminResult ($ user , $ password , $ response ->getStatusCode () === 200 );
245+ $ body = (string ) $ response ->getBody ();
246+ $ callback ->onScanAdminResult ($ user , $ password , $ response ->getStatusCode () === 200 && str_contains ($ body , 'Plugin manager ' ));
245247 return ;
246248 } catch (GuzzleException ) {
247249 $ callback ->onScanAdminResult ($ user , $ password , false );
0 commit comments