function mo_auth_test_kba_authentication in Google Authenticator / 2 Factor Authentication - 2FA 7
Menu callback for email verification.
1 string reference to 'mo_auth_test_kba_authentication'
- mo_auth_menu in ./
mo_auth.module - Implements hook_menu().
File
- ./
test_kba_authentication.inc, line 11 - Email verification functions.
Code
function mo_auth_test_kba_authentication($form, &$form_state) {
global $base_url, $user;
$user = user_load($user->uid);
$user_email = $user->miniorange_registered_email[LANGUAGE_NONE][0]['value'];
$questions = NULL;
$count = 0;
$txId = '';
if (array_key_exists('txId', $form_state['input']) === FALSE) {
$customer = new MiniorangeCustomerProfile();
$miniorange_user = new MiniorangeUser($customer
->getCustomerID(), $user_email, NULL, NULL, AuthenticationType::$KBA['code']);
$auth_api_handler = new AuthenticationAPIHandler($customer
->getCustomerID(), $customer
->getAPIKey());
$response = $auth_api_handler
->challenge($miniorange_user);
if ($response->status == 'SUCCESS') {
$questions = $response->questions;
$count = count($response->questions);
$txId = $response->txId;
}
else {
drupal_set_message(t('An error occured while processing your request. Please Try again.'), 'error');
watchdog('miniorange_2fa', $response->message);
drupal_goto('admin/config/people/mo_auth/setup');
}
}
else {
$count = $form_state['input']['question_count'];
$questions = array();
for ($i = 1; $i <= $count; $i++) {
$ques = $form_state['input']['mo2f_kbaquestion' . $i];
$ans = $form_state['input']['mo2f_kbaanswer' . $i];
$qa = NULL;
$qa->question = $ques;
$qa->answer = $ans;
array_push($questions, $qa);
}
}
$form['header']['#markup'] = t('<div class="mo2f-setup-header"><div class="mo2f-setup-header-top-left">Test Security Questions (KBA)</div></div><div class="mo2f-info">Please answer the following questions:</div>');
$form = mo_auth_create_form($form, $questions);
$form['txId'] = array(
'#type' => 'hidden',
'#value' => $txId,
);
$form['question_count'] = array(
'#type' => 'hidden',
'#value' => $count,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Verify'),
);
$form['actions']['cancel'] = array(
'#markup' => l(t('Cancel Test'), 'admin/config/people/mo_auth/setup'),
'#suffix' => '</div>',
);
return $form;
}