You are here

public function test_otp_over_sms_and_email::validateForm in Google Authenticator / 2 Factor Authentication - 2FA 8.2

Form validation 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 FormBase::validateForm

File

src/Form/test_otp_over_sms_and_email.php, line 151
OTP Over SMS and Email(test) functions.

Class

test_otp_over_sms_and_email
Menu callback for testing OTP Over SMS and Email.

Namespace

Drupal\miniorange_2fa\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (empty($form_state
    ->getValue('mo_auth_otpoversms_and_email_token'))) {
    $form_state
      ->setErrorByName('mo_auth_otpoversms_and_email_token', $this
      ->t('Please enter the passcode first.'));
  }
}