hasIp example



  /** * An attempt to login has been blocked based on user name. * * @param \Drupal\user\Event\UserFloodEvent $floodEvent * The flood event. */
  public function blockedUser(UserFloodEvent $floodEvent) {
    if (Settings::get('log_user_flood', TRUE)) {
      $uid = $floodEvent->getUid();
      if ($floodEvent->hasIp()) {
        $ip = $floodEvent->getIp();
        $this->logger->notice('Flood control blocked login attempt for uid %uid from %ip', ['%uid' => $uid, '%ip' => $ip]);
        return;
      }
      $this->logger->notice('Flood control blocked login attempt for uid %uid', ['%uid' => $uid]);
    }
  }

  /** * An attempt to login has been blocked based on IP. * * @param \Drupal\user\Event\UserFloodEvent $floodEvent * The flood event. */
Home | Imprint | This part of the site doesn't use cookies.