public function UserMfaSetup::submitForm in Google Authenticator / 2 Factor Authentication - 2FA 8.2
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ UserMfaSetup.php, line 87
Class
Namespace
Drupal\miniorange_2fa\formCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$formValues = $form_state
->getValues();
if (!$this->isAdmin && $formValues["mo_mfa_enable"] === 0) {
// TFA required means you are secured users and skipNotAllowed for you the
if (MoAuthUtilities::isSkipNotAllowed($this->entityId)) {
$this
->messenger()
->addError($this
->t("You are not allowed to disable 2FA. Please ask the site administrator"));
return;
}
}
MoAuthUtilities::updateMfaSettingsForUser($this->entityId, $formValues["mo_mfa_enable"]);
$this
->messenger()
->addStatus($this
->t('2FA settings are updated for your account'));
}