fix update user
continuous-integration/drone/push Build is passing Details

pull/94/head
maxime.batista 1 year ago
parent 8e400f0dd8
commit a7f5a71532

@ -12,7 +12,6 @@ use IQBall\Core\Validation\ValidationFail;
class API { class API {
public static function consume(HttpResponse $response): void { public static function consume(HttpResponse $response): void {
error_log("consuming response" . $response->getCode());
http_response_code($response->getCode()); http_response_code($response->getCode());
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Origin: *');

@ -94,7 +94,7 @@ class APIAccountsController {
"username" => [DefaultValidators::name()], "username" => [DefaultValidators::name()],
"isAdmin" => [DefaultValidators::bool()], "isAdmin" => [DefaultValidators::bool()],
], function (HttpRequest $req) use ($id) { ], function (HttpRequest $req) use ($id) {
$mailAccount = $this->accounts->getAccountFromMail($req["email"]); $mailAccount = $this->accounts->getAccount($id);
if ($mailAccount->getUser()->getId() != $id) { if ($mailAccount->getUser()->getId() != $id) {
return new JsonHttpResponse([new ValidationFail("email exists", "The provided mail address already exists for another account.")], HttpCodes::FORBIDDEN); return new JsonHttpResponse([new ValidationFail("email exists", "The provided mail address already exists for another account.")], HttpCodes::FORBIDDEN);
} }

@ -163,6 +163,5 @@ class AccountGateway {
":accountId" => [$accountId, PDO::PARAM_INT], ":accountId" => [$accountId, PDO::PARAM_INT],
]); ]);
} }
} }
} }

Loading…
Cancel
Save