You are here

protected function TfaTrustedBrowser::setUsed in Two-factor Authentication (TFA) 8

Updated browser last used time.

Parameters

int $id: Internal browser ID to update.

1 call to TfaTrustedBrowser::setUsed()
TfaTrustedBrowser::loginAllowed in src/Plugin/TfaLogin/TfaTrustedBrowser.php
Whether login is allowed.

File

src/Plugin/TfaLogin/TfaTrustedBrowser.php, line 168

Class

TfaTrustedBrowser
Trusted browser validation class.

Namespace

Drupal\tfa\Plugin\TfaLogin

Code

protected function setUsed($id) {
  $result = $this
    ->getUserData('tfa', 'tfa_trusted_browser', $this->uid, $this->userData);
  $result[$id]['last_used'] = \Drupal::time()
    ->getRequestTime();
  $data = [
    'tfa_trusted_browser' => $result,
  ];
  $this
    ->setUserData('tfa', $data, $this->uid, $this->userData);
}