You are here

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

Submit the setup form.

Parameters

array $form: The configuration form array.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

bool TRUE if no errors occur when saving the data.

Overrides TfaSetupInterface::submitSetupForm

File

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

Class

TfaTestValidationPluginSetupPlugin
TFA Test Validation Plugin Setup Plugin.

Namespace

Drupal\tfa_test_plugins\Plugin\TfaSetup

Code

public function submitSetupForm(array $form, FormStateInterface $form_state) {
  $encrypted = $this
    ->encrypt($form_state
    ->getValue('expected_field'));
  $record = [
    'test_data' => [
      'expected_field' => base64_encode($encrypted),
    ],
  ];
  $this
    ->setUserData($this->pluginDefinition['id'], $record, $this->uid, $this->userData);
  return TRUE;
}