class MoAuthSupport in Google Authenticator / 2 Factor Authentication - 2FA 8
Same name and namespace in other branches
- 8.2 src/Form/MoAuthSupport.php \Drupal\miniorange_2fa\Form\MoAuthSupport
Showing Support form info.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\miniorange_2fa\Form\MoAuthSupport
Expanded class hierarchy of MoAuthSupport
1 string reference to 'MoAuthSupport'
File
- src/
Form/ MoAuthSupport.php, line 15 - Contains support form for miniOrange 2FA Login Module.
Namespace
Drupal\miniorange_2fa\FormView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
FormBase:: |
protected | property | The config factory. | 1 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Retrieves a configuration object. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 1 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
87 |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function |
Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: |
|
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
FormBase:: |
public | function |
Form validation handler. Overrides FormInterface:: |
62 |
LinkGeneratorTrait:: |
protected | property | The link generator. | 1 |
LinkGeneratorTrait:: |
protected | function | Returns the link generator. | |
LinkGeneratorTrait:: |
protected | function | Renders a link to a route given a route name and its parameters. | |
LinkGeneratorTrait:: |
public | function | Sets the link generator service. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
MoAuthSupport:: |
public | function |
Form constructor. Overrides FormInterface:: |
|
MoAuthSupport:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
MoAuthSupport:: |
public | function |
Form submission handler. Overrides FormInterface:: |
|
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |