You are here

public function TfaContext::hasSkipped in Two-factor Authentication (TFA) 8

Increment the count of $this->getUser() logins without setting up TFA.

Overrides TfaContextInterface::hasSkipped

File

src/TfaContext.php, line 171

Class

TfaContext
Provide context for the current login attempt.

Namespace

Drupal\tfa

Code

public function hasSkipped() {
  $user_tfa_data = $this
    ->tfaGetTfaData($this
    ->getUser()
    ->id(), $this->userData);
  $validation_skipped = isset($user_tfa_data['validation_skipped']) ? $user_tfa_data['validation_skipped'] : 0;
  $user_tfa_data['validation_skipped'] = $validation_skipped + 1;
  $this
    ->tfaSaveTfaData($this
    ->getUser()
    ->id(), $this->userData, $user_tfa_data);
}