|
@@ 70-80 (lines=11) @@
|
| 67 |
|
* @param string $uid
|
| 68 |
|
* @return int
|
| 69 |
|
*/
|
| 70 |
|
public function getSuspiciousActivityCountForUid($uid) {
|
| 71 |
|
$builder = $this->connection->getQueryBuilder();
|
| 72 |
|
$thresholdTime = (new \DateTime())->modify("-86400 second")->getTimestamp();
|
| 73 |
|
$attempts = $builder->select('*')
|
| 74 |
|
->from('failed_login_attempts')
|
| 75 |
|
->where($builder->expr()->gt('attempted_at', $builder->createNamedParameter($thresholdTime)))
|
| 76 |
|
->andWhere($builder->expr()->eq('uid', $builder->createNamedParameter($uid)))
|
| 77 |
|
->execute()
|
| 78 |
|
->fetchAll();
|
| 79 |
|
return count($attempts);
|
| 80 |
|
}
|
| 81 |
|
|
| 82 |
|
/**
|
| 83 |
|
* @param string $ip
|
|
@@ 86-96 (lines=11) @@
|
| 83 |
|
* @param string $ip
|
| 84 |
|
* @return int
|
| 85 |
|
*/
|
| 86 |
|
public function getSuspiciousActivityCountForIp($ip) {
|
| 87 |
|
$builder = $this->connection->getQueryBuilder();
|
| 88 |
|
$thresholdTime = (new \DateTime())->modify("-86400 second")->getTimestamp();
|
| 89 |
|
$attempts = $builder->select('*')
|
| 90 |
|
->from('failed_login_attempts')
|
| 91 |
|
->where($builder->expr()->gt('attempted_at', $builder->createNamedParameter($thresholdTime)))
|
| 92 |
|
->andWhere($builder->expr()->eq('ip', $builder->createNamedParameter($ip)))
|
| 93 |
|
->execute()
|
| 94 |
|
->fetchAll();
|
| 95 |
|
return count($attempts);
|
| 96 |
|
}
|
| 97 |
|
|
| 98 |
|
public function deleteSuspiciousAttemptsForIp($ip) {
|
| 99 |
|
$builder = $this->connection->getQueryBuilder();
|