public function failedLoginsThresholdReached(AddressInterface $ip = null, $ignoreConfig = false)
    {
        $result = false;
        if ($ignoreConfig || $this->config->get('concrete.security.ban.ip.enabled')) {
            if ($ip === null) {
                $ip = $this->getRequestIPAddress();
            }
            if (!$this->isWhitelisted($ip)) {
                $thresholdSeconds = (int) $this->config->get('concrete.security.ban.ip.time');
                $thresholdTimestamp = new DateTime("-{$thresholdSeconds} seconds");
                $rs = $this->connection->executeQuery(
                    '
                        SELECT
                            ' . $this->connection->getDatabasePlatform()->getCountExpression('lcirID') . ' AS n
                        FROM
                            FailedLoginAttempts
                        WHERE
                            flaIp = ?
                            AND flaTimestamp > ?
                    ',
                    [$ip->getComparableString(), $thresholdTimestamp->format($this->connection->getDatabasePlatform()->getDateTimeFormatString())]
                );
                $count = $rs->fetchColumn();
                $rs->closeCursor();
                $thresholdAttempts = (int) $this->config->get('concrete.security.ban.ip.attempts');
                if ($count !== false && (int) $count >= $thresholdAttempts) {
                    $result = true;
                }
            }
        }

        return $result;
    }