diff --git a/src/Api/Controller/APIAccountsController.php b/src/Api/Controller/APIAccountsController.php index 6ebf0fc..fd7e88e 100644 --- a/src/Api/Controller/APIAccountsController.php +++ b/src/Api/Controller/APIAccountsController.php @@ -34,7 +34,6 @@ class APIAccountsController { */ public function listUsers(array $request): HttpResponse { return APIControl::runCheckedFrom($request, [ - 'start' => [DefaultValidators::isUnsignedInteger()], 'n' => [DefaultValidators::isIntInRange(0, 250)], 'search' => [DefaultValidators::lenBetween(0, 256)], @@ -97,8 +96,9 @@ class APIAccountsController { "username" => [DefaultValidators::name()], "isAdmin" => [DefaultValidators::bool()], ], function (HttpRequest $req) use ($id) { - $mailAccount = $this->accounts->getAccount($id); - if ($mailAccount->getUser()->getId() != $id) { + $mailAccount = $this->accounts->getAccountFromMail($req["email"]); + + if ($mailAccount != null && $mailAccount->getUser()->getId() != $id) { return new JsonHttpResponse([new ValidationFail("email exists", "The provided mail address already exists for another account.")], HttpCodes::FORBIDDEN); }