function authenticate_user::mo_auth_build_hardware_token_authenticator_form in Google Authenticator / 2 Factor Authentication - 2FA 8.2
1 call to authenticate_user::mo_auth_build_hardware_token_authenticator_form()
File
- src/
Form/ authenticate_user.php, line 376 - This is used to authenticate user during login.
Class
- authenticate_user
- @file This is used to authenticate user during login.
Namespace
Drupal\miniorange_2fa\formCode
function mo_auth_build_hardware_token_authenticator_form($form, $success_message = TRUE) {
if ($success_message === TRUE) {
$message = t('Please press the key from your Yubikey Hardware device.');
}
else {
$message = t('The passcode you have entered is incorrect. Please enter the valid passcode.');
}
$message_div_class = $success_message === TRUE ? 'mo2f-message-status' : 'mo2f-message-error';
$form['header']['#markup'] .= t('<div class="mo2f-message ' . $message_div_class . '">' . $message . '</div>');
$form['header']['#markup'] .= t('<div class="mo2f-info">Enter the passcode: </div>');
$form['token'] = array(
'#type' => 'textfield',
'#attributes' => array(
'placeholder' => t('Enter the code.'),
'class' => array(
'mo2f-textbox',
'mo2f-textbox-otp',
),
'autofocus' => TRUE,
),
'#required' => TRUE,
);
$form['mo_message'] = $message;
return $form;
}