You are here

public function MiniorangeSamlCustomerSetup::miniorange_saml_validate_otp_submit in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8

Validate OTP.

File

src/Form/MiniorangeSamlCustomerSetup.php, line 296
Contains \Drupal\miniorange_saml\Form\MiniorangeSamlCustomerSetup.

Class

MiniorangeSamlCustomerSetup

Namespace

Drupal\miniorange_saml\Form

Code

public function miniorange_saml_validate_otp_submit(&$form, FormStateInterface $form_state) {
  $form_values = $form_state
    ->getValues();
  $otp_token = trim($form_values['miniorange_saml_customer_otp_token']);
  if (empty($otp_token)) {
    \Drupal::messenger()
      ->addMessage(t('OTP field is required.'), 'error');
    return;
  }
  Utilities::validate_otp_submit($otp_token);
}