function miniorange_pass2login_form_fields() { $login_status = isset($_SESSION['mo_2factor_login_status']) ? $_SESSION['mo_2factor_login_status'] : null; $current_user = isset($_SESSION['mo2f_current_user']) ? $_SESSION['mo2f_current_user']->ID : null; if ($this->miniorange_pass2login_check_mobile_status($login_status)) { //for mobile $this->mo_2_factor_pass2login_hide_login(); $this->mo_2_factor_pass2login_show_qr_code(); } else { if ($this->miniorange_pass2login_check_otp_status($login_status)) { //for soft-token,otp over email,sms,phone verification $this->mo_2_factor_pass2login_hide_login(); $this->mo_2_factor_pass2login_show_otp_token(); } else { if ($this->miniorange_pass2login_check_push_oobemail_status($login_status)) { //for push and out of band email. $this->mo_2_factor_pass2login_hide_login(); $this->mo_2_factor_pass2login_show_push_oobemail(); } else { if ($this->miniorange_pass2login_check_kba_status($login_status)) { // for Kba $this->mo_2_factor_pass2login_hide_login(); $this->mo_2_factor_pass2login_show_kba(); } else { if ($this->miniorange_pass2login_check_trusted_device_status($login_status)) { // trusted device $this->mo_2_factor_pass2login_hide_login(); $this->mo_2_factor_pass2login_show_device_page(); } else { if ($this->miniorange_pass2login_check_inline_user_registration($login_status)) { // inline registration started $this->mo_2_factor_pass2login_hide_login(); prompt_user_to_register(); } else { if ($this->miniorange_pass2login_check_inline_user_otp($login_status)) { //otp verification after user enter email during inline registration $this->mo_2_factor_pass2login_hide_login(); prompt_user_for_validate_otp(); } else { if ($this->miniorange_pass2login_check_inline_user_2fa_methods($login_status)) { // two-factor methods $this->mo_2_factor_pass2login_hide_login(); $opt = (array) get_option('mo2f_auth_methods_for_users'); if (sizeof($opt) > 1) { prompt_user_to_select_2factor_method($current_user); } else { if (in_array("SMS", $opt) || in_array("PHONE VERIFICATION", $opt)) { prompt_user_for_phone_setup($current_user); } else { if (in_array("SOFT_TOKEN", $opt) || in_array("PUSH NOTIFICATION", $opt) || in_array("MOBILE AUTHENTICATION", $opt)) { prompt_user_for_miniorange_app_setup($current_user); } else { if (in_array("GOOGLE AUTHENTICATOR", $opt)) { prompt_user_for_google_authenticator_setup($current_user); } else { if (in_array("KBA", $opt)) { prompt_user_for_kba_setup($current_user); } else { prompt_user_for_email_setup($current_user); } } } } } } else { //show login screen $this->mo_2_factor_pass2login_show_login(); $this->mo_2_factor_pass2login_show_wp_login_form(); } } } } } } } } }
function prompt_user_to_select_2factor_method($current_user) { if (get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'MOBILE AUTHENTICATION' || get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'SOFT TOKEN' || get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'PUSH NOTIFICATIONS') { prompt_user_for_miniorange_app_setup($current_user); } else { if (get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'SMS' || get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'PHONE VERIFICATION') { prompt_user_for_phone_setup($current_user); } else { if (get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'GOOGLE AUTHENTICATOR') { prompt_user_for_google_authenticator_setup($current_user); } else { if (get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'KBA') { prompt_user_for_kba_setup($current_user); } else { if (get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'OUT OF BAND EMAIL') { prompt_user_for_email_setup($current_user); } else { $opt = (array) get_option('mo2f_auth_methods_for_users'); ?> <div class="miniorange_soft_auth"> <div class="miniorange-inner-kba-login-container" > <h2 class="mo_header_background">Setup Two Factor</h2> <br> <div class="mo_margin_left"> <b>Select any Two-Factor of your choice below and complete its setup.</b> <br><br> <span class="<?php if (!in_array("OUT OF BAND EMAIL", $opt)) { echo "mo2f_td_hide"; } else { echo "mo2f_td_show"; } ?> " > <label title="You will receive an email with link. You have to click the ACCEPT or DENY link to verify your email. Supported in Desktops, Laptops, Smartphones."> <input type="radio" name="mo2f_selected_2factor_method" value="OUT OF BAND EMAIL" /> Email Verification </label> <br> </span> <span class="<?php if (!in_array("SMS", $opt)) { echo "mo2f_td_hide"; } else { echo "mo2f_td_show"; } ?> " > <label title="You will receive a one time passcode via SMS on your phone. You have to enter the otp on your screen to login. Supported in Smartphones, Feature Phones."> <input type="radio" name="mo2f_selected_2factor_method" value="SMS" /> OTP Over SMS </label> <br> </span> <span class="<?php if (!in_array("PHONE VERIFICATION", $opt)) { echo "mo2f_td_hide"; } else { echo "mo2f_td_show"; } ?> "> <label title="You will receive a phone call telling a one time passcode. You have to enter the one time passcode to login. Supported in Landlines, Smartphones, Feature phones."> <input type="radio" name="mo2f_selected_2factor_method" value="PHONE VERIFICATION" /> Phone Call Verification </label> <br> </span> <span class="<?php if (!in_array("SOFT TOKEN", $opt)) { echo "mo2f_td_hide"; } else { echo "mo2f_td_show"; } ?> " > <label title="You have to enter 6 digits code generated by miniOrange Authenticator App like Google Authenticator code to login. Supported in Smartphones only." > <input type="radio" name="mo2f_selected_2factor_method" value="SOFT TOKEN" /> Soft Token </label> <br> </span> <span class="<?php if (!in_array("MOBILE AUTHENTICATION", $opt)) { echo "mo2f_td_hide"; } else { echo "mo2f_td_show"; } ?> "> <label title="You have to scan the QR Code from your phone using miniOrange Authenticator App to login. Supported in Smartphones only."> <input type="radio" name="mo2f_selected_2factor_method" value="MOBILE AUTHENTICATION" /> QR Code Authentication </label> <br> </span> <span class="<?php if (!in_array("PUSH NOTIFICATIONS", $opt)) { echo "mo2f_td_hide"; } else { echo "mo2f_td_show"; } ?> " > <label title="You will receive a push notification on your phone. You have to ACCEPT or DENY it to login. Supported in Smartphones only."> <input type="radio" name="mo2f_selected_2factor_method" value="PUSH NOTIFICATIONS" /> Push Notification </label> <br> </span> <span class="<?php if (!in_array("GOOGLE AUTHENTICATOR", $opt)) { echo "mo2f_td_hide"; } else { echo "mo2f_td_show"; } ?> "> <label title="You have to enter 6 digits code generated by Google Authenticaor App to login. Supported in Smartphones only."> <input type="radio" name="mo2f_selected_2factor_method" value="GOOGLE AUTHENTICATOR" /> Google Authenticator </label> <br> </span> <span class="<?php if (!in_array("KBA", $opt)) { echo "mo2f_td_hide"; } else { echo "mo2f_td_show"; } ?> "> <label title="You have to answers some knowledge based security questions which are only known to you to authenticate yourself. Supported in Desktops,Laptops,Smartphones." > <input type="radio" name="mo2f_selected_2factor_method" value="KBA" /> Security Questions ( KBA ) </label> </span> <br><br> <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" /> <br><br> </div> <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange"></div></a></div> </div> </div> <script> jQuery("div#login").hide(); jQuery("body.login div#login").before(jQuery('.miniorange_soft_auth')); function mologinback(){ jQuery('#mo2f_backto_mo_loginform').submit(); } jQuery('input:radio[name=mo2f_selected_2factor_method]').click(function() { var selectedMethod = jQuery(this).val(); document.getElementById("mo2f_select_2fa_methods_form").elements[0].value = selectedMethod; jQuery('#mo2f_select_2fa_methods_form').submit(); }); </script> <?php } } } } } }