concrete/src/Permission/IPService.php
public function addToBlacklistForThresholdReached(AddressInterface $ip = null, $ignoreConfig = false)
    {
        if ($ignoreConfig || $this->config->get('concrete.security.ban.ip.enabled')) {
            if ($ip === null) {
                $ip = $this->getRequestIPAddress();
            }
            $banDurationMinutes = (int) $this->config->get('concrete.security.ban.ip.length');
            if ($banDurationMinutes > 0) {
                $expires = new DateTime("+{$banDurationMinutes} minutes");
            } else {
                $expires = null;
            }
            $this->createRange(IPFactory::rangeFromBoundaries($ip, $ip), static::IPRANGETYPE_BLACKLIST_AUTOMATIC, $expires);
            $this->logger->warning(t('IP address %s added to blacklist.', $ip->toString(), $expires), [
                'ip_address' => $ip->toString()
            ]);
        }
    }
public function addToBlacklistForThresholdReached(AddressInterface $ip = null, $ignoreConfig = false)
    {
        if ($ignoreConfig || $this->config->get('concrete.security.ban.ip.enabled')) {
            if ($ip === null) {
                $ip = $this->getRequestIPAddress();
            }
            $banDurationMinutes = (int) $this->config->get('concrete.security.ban.ip.length');
            if ($banDurationMinutes > 0) {
                $expires = new DateTime("+{$banDurationMinutes} minutes");
            } else {
                $expires = null;
            }
            $this->createRange(IPFactory::rangeFromBoundaries($ip, $ip), static::IPRANGETYPE_BLACKLIST_AUTOMATIC, $expires);
            $this->logger->warning(t('IP address %s added to blacklist.', $ip->toString(), $expires), [
                'ip_address' => $ip->toString()
            ]);
        }
    }
public function addToBlacklistForThresholdReached ( AddressInterface $ ip = null , $ ignoreConfig = false ) { if ( $ ignoreConfig || $ this -> config -> get ( 'concrete.security.ban.ip.enabled' ) ) { if ( $ ip === null ) { $ ip = $ this -> getRequestIPAddress ( ) ; } $ banDurationMinutes = ( int ) $ this -> config -> get ( 'concrete.security.ban.ip.length' ) ; if ( $ banDurationMinutes > 0 ) { $ expires = new DateTime ( "+{$banDurationMinutes} minutes" ) ; } else { $ expires = null ; } $ this -> createRange ( IPFactory :: rangeFromBoundaries ( $ ip , $ ip ) , static :: IPRANGETYPE_BLACKLIST_AUTOMATIC , $ expires ) ; $ this -> logger -> warning ( t ( 'IP address %s added to blacklist.' , $ ip -> toString ( ) , $ expires ) , [ 'ip_address' => $ ip -> toString ( ) ] ) ; } }
Add an IP address to the list of IPs banned for too many failed login attempts.

@param AddressInterface $ip the IP to add to the blacklist (if null, we'll use the current IP address)
@param bool $ignoreConfig if set to true, we'll add the IP address even if the IP ban system is disabled in the configuration
Add an IP address to the list of IPs banned for too many failed login attempts .