From a7f5a715323beed1d43909f3a6fccbaaa1a6f4ff Mon Sep 17 00:00:00 2001 From: "maxime.batista" Date: Wed, 17 Jan 2024 11:07:03 +0100 Subject: [PATCH] fix update user --- src/Api/API.php | 1 - src/Api/Controller/APIAccountsController.php | 2 +- src/Core/Gateway/AccountGateway.php | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Api/API.php b/src/Api/API.php index b955963..cc61c8d 100644 --- a/src/Api/API.php +++ b/src/Api/API.php @@ -12,7 +12,6 @@ use IQBall\Core\Validation\ValidationFail; class API { public static function consume(HttpResponse $response): void { - error_log("consuming response" . $response->getCode()); http_response_code($response->getCode()); header('Access-Control-Allow-Origin: *'); diff --git a/src/Api/Controller/APIAccountsController.php b/src/Api/Controller/APIAccountsController.php index 4ad3db7..1956b80 100644 --- a/src/Api/Controller/APIAccountsController.php +++ b/src/Api/Controller/APIAccountsController.php @@ -94,7 +94,7 @@ class APIAccountsController { "username" => [DefaultValidators::name()], "isAdmin" => [DefaultValidators::bool()], ], function (HttpRequest $req) use ($id) { - $mailAccount = $this->accounts->getAccountFromMail($req["email"]); + $mailAccount = $this->accounts->getAccount($id); if ($mailAccount->getUser()->getId() != $id) { return new JsonHttpResponse([new ValidationFail("email exists", "The provided mail address already exists for another account.")], HttpCodes::FORBIDDEN); } diff --git a/src/Core/Gateway/AccountGateway.php b/src/Core/Gateway/AccountGateway.php index 44a8b58..3c5070a 100644 --- a/src/Core/Gateway/AccountGateway.php +++ b/src/Core/Gateway/AccountGateway.php @@ -163,6 +163,5 @@ class AccountGateway { ":accountId" => [$accountId, PDO::PARAM_INT], ]); } - } }