You are here

public function TfaTestValidationPluginSetupPlugin::getExpectedFieldData in Two-factor Authentication (TFA) 8

Get and decode the data expected during setup.

Return value

null|string The string if found, otherwise NULL;

Throws

\Drupal\encrypt\Exception\EncryptionMethodCanNotDecryptException

\Drupal\encrypt\Exception\EncryptException

File

tests/modules/tfa_test_plugins/src/Plugin/TfaSetup/TfaTestValidationPluginSetupPlugin.php, line 91

Class

TfaTestValidationPluginSetupPlugin
TFA Test Validation Plugin Setup Plugin.

Namespace

Drupal\tfa_test_plugins\Plugin\TfaSetup

Code

public function getExpectedFieldData() {
  $data = $this
    ->getUserData($this->pluginDefinition['id'], 'test_data', $this->uid, $this->userData);
  if (!empty($data['expected_field'])) {
    return $this
      ->decrypt(base64_decode($data['expected_field']));
  }
  return NULL;
}