You are here

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

Check if browser id matches user's saved browser.

Parameters

string $id: The browser ID.

Return value

bool TRUE if ID exists otherwise FALSE.

2 calls to TfaTrustedBrowser::trustedBrowser()
TfaTrustedBrowser::loginAllowed in src/Plugin/TfaLogin/TfaTrustedBrowser.php
Whether login is allowed.
TfaTrustedBrowserSetup::getSetupForm in src/Plugin/TfaSetup/TfaTrustedBrowserSetup.php
Get the setup form for the validation method.

File

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

Class

TfaTrustedBrowser
Trusted browser validation class.

Namespace

Drupal\tfa\Plugin\TfaLogin

Code

protected function trustedBrowser($id) {

  // Check if $id has been saved for this user.
  $result = $this
    ->getUserData('tfa', 'tfa_trusted_browser', $this->uid, $this->userData);
  if (isset($result[$id])) {
    return TRUE;
  }
  return FALSE;
}