You are here

function AutoLoginUrlGeneral::registerFlood in Auto Login URL 8

Same name and namespace in other branches
  1. 2.x src/AutoLoginUrlGeneral.php \Drupal\auto_login_url\AutoLoginUrlGeneral::registerFlood()

Register flood event for this IP.

Parameters

string $hash: Code that passes through URL.

File

src/AutoLoginUrlGeneral.php, line 48

Class

AutoLoginUrlGeneral
Class AutoLoginUrlGeneral.

Namespace

Drupal\auto_login_url

Code

function registerFlood($hash) {
  $flood_config = \Drupal::config('user.flood');
  $flood = \Drupal::flood();

  // Register flood event.
  $flood
    ->register('user.failed_login_ip', $flood_config
    ->get('ip_window'));

  // Log error.
  \Drupal::logger('auto_login_url')
    ->error('Failed Auto Login URL from ip: @ip and hash: @hash', [
    '@ip' => \Drupal::request()
      ->getClientIp(),
    '@hash' => $hash,
  ]);
}