function mo_auth_challenge_user in Google Authenticator / 2 Factor Authentication - 2FA 7
1 call to mo_auth_challenge_user()
File
- ./
mo_auth.module, line 543 - Module file for miniOrange 2FA Module.
Code
function mo_auth_challenge_user($user, &$form_state) {
$user_email = $user->miniorange_registered_email[LANGUAGE_NONE][0]['value'];
$customer = new MiniorangeCustomerProfile();
$miniorange_user = new MiniorangeUser($customer
->getCustomerID(), $user_email, NULL, NULL, NULL);
$auth_api_handler = new AuthenticationAPIHandler($customer
->getCustomerID(), $customer
->getAPIKey());
$response = $auth_api_handler
->challenge($miniorange_user);
if (isset($response) && $response->status == 'SUCCESS') {
$_SESSION['mo_auth']['mo_challenge_response'] = $response;
$form_state['redirect'] = 'login/user/' . $user->uid . '/authenticate';
$url = $form_state['redirect'];
drupal_goto($url);
}
else {
drupal_set_message(t('An error occured while processing your request. Please Try again.'), 'error');
watchdog('miniorange_2fa', $response->message);
drupal_goto('user');
}
return;
}