protected function TfaTrustedBrowser::generateBrowserId in Two-factor Authentication (TFA) 8
Generate a random value to identify the browser.
Return value
string Base64 encoded browser id.
Throws
\Exception
3 calls to TfaTrustedBrowser::generateBrowserId()
- TfaTrustedBrowser::finalize in src/
Plugin/ TfaLogin/ TfaTrustedBrowser.php - Finalize the browser setup.
- TfaTrustedBrowser::submitForm in src/
Plugin/ TfaLogin/ TfaTrustedBrowser.php - Submit form.
- TfaTrustedBrowserSetup::submitSetupForm in src/
Plugin/ TfaSetup/ TfaTrustedBrowserSetup.php - Submit the setup form.
File
- src/
Plugin/ TfaLogin/ TfaTrustedBrowser.php, line 119
Class
- TfaTrustedBrowser
- Trusted browser validation class.
Namespace
Drupal\tfa\Plugin\TfaLoginCode
protected function generateBrowserId() {
$id = base64_encode(random_bytes(32));
return strtr($id, [
'+' => '-',
'/' => '_',
'=' => '',
]);
}