function prompt_user_to_select_2factor_method_frontend($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_frontend($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_frontend($current_user); } else { if (get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'GOOGLE AUTHENTICATOR') { prompt_user_for_google_authenticator_setup_frontend($current_user); } else { if (get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'KBA') { prompt_user_for_kba_setup_frontend($current_user); } else { if (get_user_meta($current_user, 'mo2f_selected_2factor_method', true) == 'OUT OF BAND EMAIL') { prompt_user_for_email_setup_frontend($current_user); } else { $opt = (array) get_option('mo2f_auth_methods_for_users'); ?> <div class="modal" tabindex="-1" role="dialog" id="myModal7"> <div class="mo2f-modal-backdrop"></div> <div class="modal-dialog mo2f-modal-lg"> <div class="modal-content"> <div class="modal-header"> <h3 class="modal-title"><button type="button" class="close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">×</span></button> Select Two Factor Method</h3> </div> <div class="modal-body"> <b>Select Any Two-Factor of your choice below and complete its setup.</b> <br> <input type="hidden" name="option" value="mo_2factor_validate_user_otp" /> <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." class="mo2f_label"> <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." class="mo2f_label"> <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." class="mo2f_label"> <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 class="mo2f_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 class="mo2f_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 class="mo2f_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." class="mo2f_label"> <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." class="mo2f_label"> <input type="radio" name="mo2f_selected_2factor_method" value="KBA" /> Security Questions( KBA ) </label> </span> <br><br> </div> <?php if (get_option('mo2f_disable_poweredby') != 1) { ?> <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if (get_option('mo2f_enable_custom_poweredby') == 1) { echo site_url() . '/wp-content/uploads/custom.png'; } else { echo plugins_url('/includes/images/miniOrange2.png', __FILE__); } ?> ');"></div></a></div> <?php } ?> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <style> .woocommerce .woocommerce-error { display: none !important; } </style> <script> jQuery('.woocommerce-error').hide(); jQuery('#myModal7').modal('show'); function mologinback(){ jQuery('#mo2f_2fa_form_close').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 } } } } } }
function miniorange_pass2login_form_fields_frontend() { $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 mo2f_frontend_getqrcode(); } else { if ($this->miniorange_pass2login_check_otp_status($login_status)) { //for soft-token,otp over email,sms,phone verification mo2f_frontend_getotp_form(); } else { if ($this->miniorange_pass2login_check_push_oobemail_status($login_status)) { //for push and out of band email. mo2f_frontend_getpush_oobemail_response(); } else { if ($this->miniorange_pass2login_check_kba_status($login_status)) { // for Kba $this->mo2f_frontend_get_kba_form(); } else { if ($this->miniorange_pass2login_check_trusted_device_status($login_status)) { mo2f_frontend_get_trusted_device_form(); } else { if ($this->miniorange_pass2login_check_inline_user_registration($login_status)) { $this->mo_2_factor_pass2login_hide_login(); prompt_user_to_register_frontend(); } else { if ($this->miniorange_pass2login_check_inline_user_otp($login_status)) { $this->mo_2_factor_pass2login_hide_login(); prompt_user_for_validate_otp_frontend(); } else { if ($this->miniorange_pass2login_check_inline_user_2fa_methods($login_status)) { $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_frontend($current_user); } else { if (in_array("SMS", $opt) || in_array("PHONE VERIFICATION", $opt)) { prompt_user_for_phone_setup_frontend($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_frontend($current_user); } else { if (in_array("GOOGLE AUTHENTICATOR", $opt)) { prompt_user_for_google_authenticator_setup_frontend($current_user); } else { if (in_array("KBA", $opt)) { prompt_user_for_kba_setup_frontend($current_user); } else { prompt_user_for_email_setup_frontend($current_user); } } } } } } } } } } } } } }