function mo2f_get_activated_second_factor($current_user) { if (get_user_meta($current_user->ID, 'mo_2factor_mobile_registration_status', true) == 'MO_2_FACTOR_SUCCESS') { //checking this option for existing users update_user_meta($current_user->ID, 'mo2f_mobile_registration_status', true); $mo2f_second_factor = 'MOBILE AUTHENTICATION'; return $mo2f_second_factor; } else { if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR') { return 'NONE'; } else { //for new users if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' && get_user_meta($current_user->ID, 'mo_2factor_user_registration_with_miniorange', true) == 'SUCCESS') { $enduser = new Two_Factor_Setup(); $userinfo = json_decode($enduser->mo2f_get_userinfo(get_user_meta($current_user->ID, 'mo_2factor_map_id_with_email', true)), true); if (json_last_error() == JSON_ERROR_NONE) { if ($userinfo['status'] == 'ERROR') { update_option('mo2f_message', $userinfo['message']); $mo2f_second_factor = 'NONE'; } else { if ($userinfo['status'] == 'SUCCESS') { $mo2f_second_factor = $userinfo['authType']; } else { if ($userinfo['status'] == 'FAILED') { $mo2f_second_factor = 'NONE'; update_option('mo2f_message', 'Your account has been removed.Please contact your administrator.'); } else { $mo2f_second_factor = 'NONE'; } } } } else { update_option('mo2f_message', 'Invalid Request. Please try again.'); $mo2f_second_factor = 'NONE'; } } else { $mo2f_second_factor = 'NONE'; } return $mo2f_second_factor; } } }
function mo2f_get_user_2ndfactor($current_user) { if (get_user_meta($current_user->ID, 'mo_2factor_mobile_registration_status', true) == 'MO_2_FACTOR_SUCCESS') { $mo2f_second_factor = 'MOBILE AUTHENTICATION'; } else { $enduser = new Two_Factor_Setup(); $userinfo = json_decode($enduser->mo2f_get_userinfo(get_user_meta($current_user->ID, 'mo_2factor_map_id_with_email', true)), true); if (json_last_error() == JSON_ERROR_NONE) { if ($userinfo['status'] == 'ERROR') { $mo2f_second_factor = 'NONE'; } else { if ($userinfo['status'] == 'SUCCESS') { $mo2f_second_factor = $userinfo['authType']; } else { if ($userinfo['status'] == 'FAILED') { $mo2f_second_factor = 'USER_NOT_FOUND'; } else { $mo2f_second_factor = 'NONE'; } } } } else { $mo2f_second_factor = 'NONE'; } } return $mo2f_second_factor; }