You are here

public static function MoAuthUtilities::send_support_query in Google Authenticator / 2 Factor Authentication - 2FA 8

Same name and namespace in other branches
  1. 8.2 src/MoAuthUtilities.php \Drupal\miniorange_2fa\MoAuthUtilities::send_support_query()
2 calls to MoAuthUtilities::send_support_query()
MoAuthSupport::submitForm in src/Form/MoAuthSupport.php
Form submission handler.
MoAuthUtilities::get_support_query_data in src/MoAuthUtilities.php

File

src/MoAuthUtilities.php, line 102
This file is part of miniOrange 2FA module.

Class

MoAuthUtilities

Namespace

Drupal\miniorange_2fa

Code

public static function send_support_query($email, $phone, $query) {
  if (empty($email) || empty($query)) {
    \Drupal::messenger()
      ->addMessage(t('The <b><u>Email</u></b> and <b><u>Query</u></b> fields are mandatory.'), 'error');
    return;
  }
  elseif (!\Drupal::service('email.validator')
    ->isValid($email)) {
    \Drupal::messenger()
      ->addMessage(t('The email address <b><i>' . $email . '</i></b> is not valid.'), 'error');
    return;
  }
  $support = new Miniorange2FASupport($email, $phone, $query);
  $support_response = $support
    ->sendSupportQuery();
  if ($support_response) {
    \Drupal::messenger()
      ->addMessage(t('Thanks for getting in touch! We will get back to you shortly.'));
  }
  else {
    \Drupal::messenger()
      ->addMessage(t('Error submitting the support query. Please send us your query at <a href="mailto:info@xecurify.com">info@xecurify.com</a>.'), 'error');
  }
}