summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2021-12-01 18:40:41 +0100
committerGitHub <noreply@github.com>2021-12-01 18:40:41 +0100
commit4c503db75dfa69959af83e841b786867612404f0 (patch)
treecc4685604130868706c849b91c7f814ce62eeede /lib
parentc21173ff2714e6c5ef0470cf3bc0efd57d98f291 (diff)
parent1d550ab95e55e5130839080478e27a1093695aa0 (diff)
downloadnextcloud-server-4c503db75dfa69959af83e841b786867612404f0.tar.gz
nextcloud-server-4c503db75dfa69959af83e841b786867612404f0.zip
Merge pull request #30013 from nextcloud/bugfix/noid/dont-count-attempts-when-we-just-deleted
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Security/Bruteforce/Throttler.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php
index 6c898cdf7e6..fa4c58e4559 100644
--- a/lib/private/Security/Bruteforce/Throttler.php
+++ b/lib/private/Security/Bruteforce/Throttler.php
@@ -66,6 +66,8 @@ class Throttler {
private $logger;
/** @var IConfig */
private $config;
+ /** @var bool */
+ private $hasAttemptsDeleted = false;
/**
* @param IDBConnection $db
@@ -230,7 +232,7 @@ class Throttler {
$maxAgeHours = 48;
}
- if ($ip === '') {
+ if ($ip === '' || $this->hasAttemptsDeleted) {
return 0;
}
@@ -306,7 +308,9 @@ class Throttler {
->andWhere($qb->expr()->eq('action', $qb->createNamedParameter($action)))
->andWhere($qb->expr()->eq('metadata', $qb->createNamedParameter(json_encode($metadata))));
- $qb->execute();
+ $qb->executeStatement();
+
+ $this->hasAttemptsDeleted = true;
}
/**