summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-06-13 09:30:51 +0200
committerJoas Schilling <coding@schilljs.com>2022-06-13 09:30:51 +0200
commit6eb692da7fe73c899cb6a8d2aa045eddb1f14018 (patch)
tree597c2f687612bd734e049a7df55a03f09eb44529 /apps
parent4ecedffb5b97604c7cfa88e8bd427177d7d3fc82 (diff)
downloadnextcloud-server-6eb692da7fe73c899cb6a8d2aa045eddb1f14018.tar.gz
nextcloud-server-6eb692da7fe73c899cb6a8d2aa045eddb1f14018.zip
Correctly log failed attempts
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/cloud_federation_api/lib/Controller/RequestHandlerController.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
index 53448119af3..ef77f2fa317 100644
--- a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
+++ b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
@@ -157,19 +157,23 @@ class RequestHandlerController extends Controller {
$shareWith = $this->mapUid($shareWith);
if (!$this->userManager->userExists($shareWith)) {
- return new JSONResponse(
+ $response = new JSONResponse(
['message' => 'User "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()],
Http::STATUS_BAD_REQUEST
);
+ $response->throttle();
+ return $response;
}
}
if ($shareType === 'group') {
if (!$this->groupManager->groupExists($shareWith)) {
- return new JSONResponse(
+ $response = new JSONResponse(
['message' => 'Group "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()],
Http::STATUS_BAD_REQUEST
);
+ $response->throttle();
+ return $response;
}
}
@@ -253,10 +257,12 @@ class RequestHandlerController extends Controller {
Http::STATUS_BAD_REQUEST
);
} catch (ShareNotFound $e) {
- return new JSONResponse(
+ $response = new JSONResponse(
['message' => $e->getMessage()],
Http::STATUS_BAD_REQUEST
);
+ $response->throttle();
+ return $response;
} catch (ActionNotSupportedException $e) {
return new JSONResponse(
['message' => $e->getMessage()],
@@ -265,7 +271,9 @@ class RequestHandlerController extends Controller {
} catch (BadRequestException $e) {
return new JSONResponse($e->getReturnMessage(), Http::STATUS_BAD_REQUEST);
} catch (AuthenticationFailedException $e) {
- return new JSONResponse(["message" => "RESOURCE_NOT_FOUND"], Http::STATUS_FORBIDDEN);
+ $response = new JSONResponse(['message' => 'RESOURCE_NOT_FOUND'], Http::STATUS_FORBIDDEN);
+ $response->throttle();
+ return $response;
} catch (\Exception $e) {
return new JSONResponse(
['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()],