Merge pull request #30013 from nextcloud/bugfix/noid/dont-count-attempts-when-we-just-deleted

This commit is contained in:
John Molakvoæ 2021-12-01 18:40:41 +01:00 committed by GitHub
commit 4c503db75d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}
/**