function handle_page_two_submit in Google Authenticator / 2 Factor Authentication - 2FA 7
1 call to handle_page_two_submit()
File
- ./
mo_auth_inline_registration.inc, line 606
Code
function handle_page_two_submit($form, &$form_state) {
$form_state["rebuild"] = TRUE;
// Added
$email = $form_state['storage']['page_one_values']['mo_auth_user_email'];
$user_search_response = $form_state['storage']['page_one_values']['user_search_response'];
$getUserObj = user_load_by_mail($email);
$customer = new MiniorangeCustomerProfile();
$miniorange_user = new MiniorangeUser($customer
->getCustomerID(), $email, NULL, $getUserObj->name, AuthenticationType::$EMAIL_VERIFICATION['code']);
$user_api_handler = new UsersAPIHandler($customer
->getCustomerID(), $customer
->getAPIKey());
if ($user_search_response->status == 'USER_NOT_FOUND') {
$create_response = $user_api_handler
->create($miniorange_user);
if ($create_response->status == 'ERROR') {
$form_state['storage']['user_limit_exceeded'] = TRUE;
return;
}
}
// Update User Auth method to OUT OF BAND EMAIL
$user_update_response = $user_api_handler
->update($miniorange_user);
if ($user_update_response->status == 'SUCCESS') {
$user = user_load($form_state['uid']);
/*
take decision if third page is required or not
there are 2 condition
1. 3rd page is not required but 4th page is required
2. Both 3rd and 4th page both are not required
*/
if (isThirdPageRequired()) {
$form_state['storage']['page_three'] = TRUE;
}
else {
$form_state['storage']['page_four'] = TRUE;
$form_state['storage']['page_three_values']['mo_auth_method'] = onlySelectedMethod();
if (!isFourthPageRequired()) {
$form_state['storage']['page_five'] = TRUE;
}
}
// $form_state['storage']['page_two_values'] = $form_state['values'];
/*
* $user->miniorange_registered_email[LANGUAGE_NONE][0]['value'] = $email;
* $user->configured_auth_methods[LANGUAGE_NONE][0]['value'] = array(
* AuthenticationType::$EMAIL_VERIFICATION['code']
* );
* $registered_emails = variable_get('mo_auth_users_registered_emails');
* $registered_emails[$email] = TRUE;
* variable_set('mo_auth_users_registered_emails', $registered_emails);
*/
return;
}
// Handle error. return to login.
}