diff options
author | Joas Schilling <coding@schilljs.com> | 2023-01-20 13:10:09 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-02-07 07:39:12 +0100 |
commit | 6a3d9861020d18918ff3e01dce46af150766c721 (patch) | |
tree | 4fb9029ca8d8bc2632e071cfd5d236482a2c1397 | |
parent | 5b2dea6e031fa197395bc0896c42f8aee24e6195 (diff) | |
download | nextcloud-server-6a3d9861020d18918ff3e01dce46af150766c721.tar.gz nextcloud-server-6a3d9861020d18918ff3e01dce46af150766c721.zip |
Add bruteforce protection to password reset page
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | core/Controller/LostController.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index e7960dbcef5..1a241790641 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -128,6 +128,8 @@ class LostController extends Controller { * * @PublicPage * @NoCSRFRequired + * @BruteForceProtection(action=passwordResetEmail) + * @AnonRateThrottle(limit=10, period=300) */ public function resetform(string $token, string $userId): TemplateResponse { try { @@ -137,12 +139,14 @@ class LostController extends Controller { || ($e instanceof InvalidTokenException && !in_array($e->getCode(), [InvalidTokenException::TOKEN_NOT_FOUND, InvalidTokenException::USER_UNKNOWN])) ) { - return new TemplateResponse( + $response = new TemplateResponse( 'core', 'error', [ "errors" => [["error" => $e->getMessage()]] ], TemplateResponse::RENDER_AS_GUEST ); + $response->throttle(); + return $response; } return new TemplateResponse('core', 'error', [ 'errors' => [['error' => $this->l10n->t('Password reset is disabled')]] |