You are here

class MoAuthSupport in Google Authenticator / 2 Factor Authentication - 2FA 8

Same name and namespace in other branches
  1. 8.2 src/Form/MoAuthSupport.php \Drupal\miniorange_2fa\Form\MoAuthSupport

Showing Support form info.

Hierarchy

Expanded class hierarchy of MoAuthSupport

1 string reference to 'MoAuthSupport'
miniorange_2fa.routing.yml in ./miniorange_2fa.routing.yml
miniorange_2fa.routing.yml

File

src/Form/MoAuthSupport.php, line 15
Contains support form for miniOrange 2FA Login Module.

Namespace

Drupal\miniorange_2fa\Form
View source
class MoAuthSupport extends FormBase {
  public function getFormId() {
    return 'miniorange_2fa_support';
  }
  public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
    $form['markup_library'] = array(
      '#attached' => array(
        'library' => array(
          "miniorange_2fa/miniorange_2fa.license",
        ),
      ),
    );
    $form['markup_1'] = array(
      '#markup' => '<div class="mo_saml_table_layout_1"><div class="mo_saml_table_layout mo_saml_container">
                        <h3>New 2FA method request</h3><div>Need new 2FA method? Just send us a requirement so we can help you.<br /><br /></div>',
    );
    $email = '';
    $phone = '';
    if (MoAuthUtilities::isCustomerRegistered()) {
      $customer = new MiniorangeCustomerProfile();
      $email = $customer
        ->getRegisteredEmail();
      $phone = $customer
        ->getRegisteredPhone();
    }
    $form['mo_auth_email_address'] = array(
      '#type' => 'textfield',
      '#title' => t('Email Address'),
      '#default_value' => $email,
      '#attributes' => array(
        'placeholder' => 'Enter your email',
        'class' => array(
          'mo_auth_new_2fa',
        ),
      ),
      '#required' => TRUE,
    );
    $form['mo_auth_phone_number'] = array(
      '#type' => 'textfield',
      '#title' => t('Phone number'),
      '#default_value' => $phone,
      '#id' => 'query_phone',
      '#description' => 'Enter number with country code Eg. +00xxxxxxxxxx',
      '#attributes' => array(
        'class' => array(
          'query_phone',
          'mo_auth_new_2fa',
        ),
        'placeholder' => 'Enter number with country code Eg. +00xxxxxxxxxx',
      ),
    );
    $form['mo_auth_support_query'] = array(
      '#type' => 'textarea',
      '#id' => "mo_auth_new_2fa_text_area",
      '#title' => t('Description'),
      '#cols' => 5,
      '#rows' => 5,
      '#attributes' => array(
        'placeholder' => 'Describe your requirement here!',
        'class' => array(
          'mo_auth_new_2fa',
        ),
      ),
      '#required' => TRUE,
      '#suffix' => '<br>',
    );
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
    );
    $form['markup_support_1'] = array(
      '#markup' => '<br><br><br><br></div><div class="mo_saml_table_layout_support_1 mo_saml_container" id="ma_saml_support_query">
                <h3><b>Know more about module:</b></h3><div>Need any help? We can help you with configuring miniOrange 2FA module on your site. Just send us a query and we will get back to you soon.<br /></div><br>',
    );
    $form['markup_support_2'] = array(
      '#markup' => '<div>Click <a target="_blank" href="https://plugins.miniorange.com/drupal-two-factor-authentication-2fa">here</a> to know more about Drupal 8 2FA module.<br>
                          Click <a target="_blank" href="https://plugins.miniorange.com/drupal-2-factor-authentication-google-authentication">here</a> to see setup guide for Drupal 8 2FA module.<br><br>
                          Click <a target="_blank" href="https://plugins.miniorange.com/drupal">here</a> to see all other security related products which we provide for drupal.<br>
                          </div><br><br>',
    );
    MoAuthUtilities::faq($form, $form_state);
    $form['miniorange_markup_end'] = array(
      '#markup' => '</div></div>',
    );
    return $form;
  }
  public function submitForm(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {
    $email = $form['mo_auth_email_address']['#value'];
    $phone = $form['mo_auth_phone_number']['#value'];
    $query = $form['mo_auth_support_query']['#value'];
    MoAuthUtilities::send_support_query($email, $phone, $query);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
FormBase::$configFactory protected property The config factory. 1
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::config protected function Retrieves a configuration object.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create 87
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
FormBase::validateForm public function Form validation handler. Overrides FormInterface::validateForm 62
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
MoAuthSupport::buildForm public function Form constructor. Overrides FormInterface::buildForm
MoAuthSupport::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId
MoAuthSupport::submitForm public function Form submission handler. Overrides FormInterface::submitForm
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.