public function MobileNumberTfa::submitForm in Mobile Number 8
Same name and namespace in other branches
- 2.0.x src/Plugin/TfaValidation/MobileNumberTfa.php \Drupal\mobile_number\Plugin\TfaValidation\MobileNumberTfa::submitForm()
Submit form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
bool Whether plugin form handling is complete. Plugins should return FALSE to invoke multi-step.
Overrides TfaBasePlugin::submitForm
File
- src/
Plugin/ TfaValidation/ MobileNumberTfa.php, line 132 - MobileNumberTfa.php
Class
- MobileNumberTfa
- Class MobileNumberTfa is a validation and sending plugin for TFA.
Namespace
Drupal\mobile_number\Plugin\TfaValidationCode
public function submitForm(array $form, FormStateInterface &$form_state) {
// Resend code if pushed.
if ($form_state['values']['op'] === $form_state['values']['resend']) {
if (!$this->mobileNumberUtil
->checkFlood($this->mobileNumber, 'sms')) {
$this->messenger
->addError(t('Too many verification code requests, please try again shortly.'));
}
elseif (!$this
->sendCode()) {
$this->messenger
->addError(t('Unable to deliver the code. Please contact support.'));
}
else {
$this->messenger
->addMessage(t('Hello world'));
}
return FALSE;
}
else {
return parent::submitForm($form, $form_state);
}
}