public function MobileNumberTfa::submitForm in Mobile Number 2.0.x
Same name and namespace in other branches
- 8 src/Plugin/TfaValidation/MobileNumberTfa.php \Drupal\mobile_number\Plugin\TfaValidation\MobileNumberTfa::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);
}
}