You are here

public function CredentialsCheckFlood::register in Commerce Core 8.2

Registers a new failed credentials check by the given user.

Parameters

string $ip: The client IP address.

string $name: The account name.

Overrides CredentialsCheckFloodInterface::register

File

src/CredentialsCheckFlood.php, line 63

Class

CredentialsCheckFlood
Provides flood protection for login credential checks.

Namespace

Drupal\commerce

Code

public function register($ip, $name) {

  // Register a per-ip failed credentials check event.
  $this->flood
    ->register('user.failed_login_ip', $this->config
    ->get('ip_window'), $ip);

  // Register a per-user failed credentials check event.
  if ($identifier = $this
    ->getAccountIdentifier($ip, $name)) {
    $this->flood
      ->register('user.failed_login_user', $this->config
      ->get('user_window'), $identifier);
  }
}