function mo_auth_build_form in Google Authenticator / 2 Factor Authentication - 2FA 7
2 calls to mo_auth_build_form()
- mo_auth_authenticate_user in ./
authenticate_user.inc - @file This is used to authenticate user during login.
- mo_auth_build_form_with_error_message in ./
authenticate_user.inc
File
- ./
authenticate_user.inc, line 179 - This is used to authenticate user during login.
Code
function mo_auth_build_form($form, $user, $base_url, $authType, $challenge_response, $success_form = TRUE, $empty_token = FALSE) {
$form['main-header']['#markup'] = t('<style>#messages div.messages{visibility:hidden;}</style>');
$form['header']['#markup'] = t('<div class="mo2f-modal">
<div class="mo2f-modal-content">
<div class="mo2f-modal-container mo2f-modal-header">Verify your identity</div>
<div class="mo2f-modal-container">');
$submit_attributes = array();
$user_configured_methods_array = $user->configured_auth_methods['und'];
$form = mo_auth_build_form_content($form, $user, $base_url, $authType, $challenge_response, $success_form, $empty_token);
if (isset($form['submit_attributes'])) {
$submit_attributes = $form['submit_attributes'];
}
unset($form['submit_attributes']);
if (variable_get('mo_auth_2fa_allow_reconfigure_2fa', 'Allowed') == 'Allowed') {
$form['mo_auth_change_2fa'] = array(
'#type' => 'checkbox',
'#title' => t('I want to change/reconfigure my 2FA method.'),
'#description' => t('<strong>Note:</strong> If you want to change/reconfigure the 2FA method then please check this checkbox and complete the authentication.'),
);
}
if (variable_get('mo_auth_remember_device', '') === 'Allowed') {
$form['mo_auth_remember_device'] = array(
'#type' => 'checkbox',
'#title' => t('I want to remember this device.'),
'#description' => t('<strong>Note:</strong> If you want to remember this device then please check this checkbox and complete the authentication.'),
);
}
$form['loader']['#markup'] = '</div><div class="mo2f-modal-container mo2f-modal-footer">';
$submit_attributes['class'] = array(
'mo2f_button',
);
$form['actions']['verify'] = array(
'#type' => 'submit',
'#value' => t('Verify'),
'#attributes' => $submit_attributes,
);
if ($authType['code'] != 'KBA' && MoAuthUtilities::isKbaConfigured($user_configured_methods_array)) {
$form['actions']['mo_auth_forgot_phone_btn'] = array(
'#type' => 'submit',
'#attributes' => array(
'class' => array(
'mo_auth_forgot_phone_btn_class',
'mo2f_button',
),
'autofocus' => 'FALSE',
),
'#value' => t('Forgot phone?'),
'#limit_validation_errors' => array(),
'#submit' => array(
'mo_auth_forgot_phone',
),
);
}
$form['actions']['cancel'] = array(
'#markup' => l(t('Back to Login'), 'user'),
'#suffix' => '</div></div></div>',
);
return $form;
}