<?php if (mo2f_is_customer_registered()) { class MO2F_ShortCode { public function mo2FAFormShortCode() { if (!is_user_logged_in()) { $html = ''; $html .= "<link rel='stylesheet' id='bootstrap_style-css' href='" . plugins_url('includes/css/bootstrap.min.css?version=3.4', __FILE__) . "' type='text/css' media='all' />\n\t\t\t<link rel='stylesheet' id='2fa_login_style-css' href='" . plugins_url('includes/css/front_end_login.css?version=3.4', __FILE__) . "' type='text/css' media='all' />"; $login_status = isset($_SESSION['mo_2factor_login_status']) ? $_SESSION['mo_2factor_login_status'] : null; if ($login_status == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' || $login_status == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL') { $html .= "<div class='modal' tabindex='-1' role='dialog' id='mo2f-modal1'><div class='mo2f-modal-backdrop'></div>\n\t\t<div class='modal-dialog'>\n\t\t\t<div class='modal-content'>\n\t\t\t<div class='modal-header'>\n\t\t\t\t<button type='button' class='close' data-dismiss='modal' aria-label='Close' onclick='mologinback();'><span aria-hidden='true'>×</span></button>\n\t\t\t</div>\n\t\t<div class='modal-body center'>\n\t\n\t\t\t<div id='otpMessage' > \n\t\t\t\t<p class='mo2fa_display_message_frontend'>" . $_SESSION['mo2f-login-message'] . "</p>\n\t\t\t</div>\n\t\n\t\t\t<div id='mo_2_factor_push_page'>\n\t\t\t<center>\n\t\t\t\t<div id='pushSection'>\n\t\t\t\t\t\n\t\t\t\t\t<a href='#showPushHelp' id='pushHelpLink' class='mo2f-link'>See How It Works ?</a>\n\t\t\t\t\t<br>\n\t\t\t\t\n\t\t\t\t\t<h4>Waiting for your approval...</h4>\n\t\t\t\n\t\t\t\t\t<div id='showPushImage' style='margin-bottom:10%;'>\n\t\t\t\n\t\t\t\t\t\t<img src='" . plugins_url('includes/images/ajax-loader-login.gif', __FILE__) . "' style='display:inline!important;'/>\n\t\t\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style='display:table-row;'\t>"; if (isset($_SESSION['mo_2factor_login_status']) && $_SESSION['mo_2factor_login_status'] == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS') { if (get_option('mo2f_enable_forgotphone')) { $html .= "<a name='miniorange_login_forgotphone' onclick='mologinforgotphone();' id='miniorange_login_forgotphone' class='mo2f-link' >Forgot Phone?</a>"; } $html .= "\t \n\t\t\t\t\t\t<a name='miniorange_login_offline' onclick='mologinoffline();' id='miniorange_login_offline' class='mo2f-link' >Phone is Offline?</a>"; } $html .= "\t</div>\n\t\t\t\t\t\t<br>\n\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t</center>\n\t\t\t\t<div id='showPushHelp' class='showPushHelp' hidden>\n\t\t\t\t\t<br>\n\t\t\t\t\t<center><a href='#showPushHelp' id='pushLink' class='mo2f-link'>←Go Back.</a>\n\t\t\t\t\t<br>\n\t\t\t\t\t\t<div id='myCarousel' class='carousel slide' data-ride='carousel'>\n\t\t\t\t\t\t <ol class='carousel-indicators'>\n\t\t\t\t\t\t\t<li data-target='#myCarousel' data-slide-to='0' class='active'></li>\n\t\t\t\t\t\t\t<li data-target='#myCarousel' data-slide-to='1'></li>\n\t\t\t\t\t\t\t<li data-target='#myCarousel' data-slide-to='2'></li>\n\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t<div class='carousel-inner' role='listbox'>"; if ($_SESSION['mo_2factor_login_status'] == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL') { $html .= "\t<div class='item active'>\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t <img class='first-slide' src='http://miniorange.com/images/help/email-with-link-login-flow-1.png' alt='First slide'>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t <div class='item'>\n\t\t\t\t\t\t\t<p>Click on Accept Transaction link to verify your email .</p><br>\n\t\t\t\t\t\t\t<img class='first-slide' src='http://miniorange.com/images/help/email-with-link-login-flow-2.png' alt='First slide'>\n\t\t\t\t\t\t \n\t\t\t\t\t\t </div>\n\t\t\t\t\t\t <div class='item'>\n\t\t\t\t\t\t <img class='first-slide' src='http://miniorange.com/images/help/email-with-link-login-flow-3.png' alt='First slide'>\n\t\t\t\t\t\t </div>"; } else { $html .= "\t<div class='item active'>\n\t\t\t\t\t\t\t\t<p>You will receive a notification on your phone.</p><br>\n\t\t\t\t\t\t\t <img class='first-slide' src='http://miniorange.com/images/help/push-login-flow.png' alt='First slide'>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t <div class='item'>\n\t\t\t\t\t\t\t<p>Open the notification and click on accept button.</p><br>\n\t\t\t\t\t\t\t<img class='first-slide' src='http://miniorange.com/images/help/push-login-flow-1.png' alt='First slide'>\n\t\t\t\t\t\t \n\t\t\t\t\t\t </div>\n\t\t\t\t\t\t <div class='item'>\n\t\t\t\t\t\t <img class='first-slide' src='http://miniorange.com/images/help/push-login-flow-2.png' alt='First slide'>\n\t\t\t\t\t\t </div>"; } $html .= "</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</center>\n\t\t\t\t</div>\n\t\t\t\t<?php if(get_option('mo2f_disable_poweredby') != 1 ){?>\n\t\t\t\t<?php if(get_option('mo2f_enable_custom_poweredby')!=1){?>}\n\t\t\t\t<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('/miniorange-2-factor-authentication/includes/images/miniOrange2.png');'></div></a></div>\n\t\t\t\t<?php }else{\n\t\t\t\t\t<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('" . site_url() . "/wp-content/uploads/custom.png');'></div></a></div>\n\t\t\t\t}?>\n\t\t\t\t<?php }?>\n\t\t\t</div>\n\t\t\n\t\t </div><!-- /.modal-content -->\n </div><!-- /.modal-dialog -->\n</div><!-- /.modal -->\n\t\t<script>\n\t\t\tjQuery('#mo2f-modal1').modal('show');\n\t\t\t\n\t\t\tvar timeout;\n\t\t\tpollPushValidation();\n\t\t\tfunction pollPushValidation()\n\t\t\t{\t\n\t\t\t\tvar transId = '" . $_SESSION['mo2f-login-transactionId'] . "';\n\t\t\t\t\n\t\t\t\tvar jsonString = '{\"txId\":\"'+ transId + '\"}';\n\t\t\t\tvar postUrl = '" . get_option('mo2f_host_name') . "/moas/api/auth/auth-status';\n\t\t\t\t\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\turl: postUrl,\n\t\t\t\t\ttype : 'POST',\n\t\t\t\t\tdataType : 'json',\n\t\t\t\t\tdata : jsonString,\n\t\t\t\t\tcontentType : 'application/json; charset=utf-8',\n\t\t\t\t\tsuccess : function(result) {\n\t\t\t\t\t\tvar status = JSON.parse(JSON.stringify(result)).status;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (status == 'SUCCESS') {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tjQuery('#mo2f_mobile_validation_form').submit();\n\t\t\t\t\t\t} else if (status == 'ERROR' || status == 'FAILED' || status == 'DENIED') {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tjQuery('#mo2f_2fa_form_close').submit();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttimeout = setTimeout(pollPushValidation, 3000);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tjQuery('#myCarousel').carousel('pause');\n\t\t\tjQuery('#pushHelpLink').click(function() {\n\t\t\t\tjQuery('#showPushHelp').show();\n\t\t\t\tjQuery('#pushSection').hide();\n\t\t\t\t\n\t\t\t\tjQuery('#myCarousel').carousel(0); \n\t\t\t});\n\t\t\tjQuery('#pushLink').click(function() {\n\t\t\t\tjQuery('#showPushHelp').hide();\n\t\t\t\tjQuery('#pushSection').show();\n\t\t\t\tjQuery('#myCarousel').carousel('pause');\n\t\t\t});\n\t\t\tfunction mologinback(){\n\t\t\t\tjQuery('#mo2f_2fa_form_close').submit();\n\t\t\t }\n\t\t\t function mologinoffline(){\n\t\t\t\tjQuery('#mo2f_show_softtoken_loginform').submit();\n\t\t\t }\n\t\t\t function mologinforgotphone(){\n\t\t\t\tjQuery('#mo2f_show_forgotphone_loginform').submit();\n\t\t\t }\n\t\t\t </script>\n\t"; } if ($login_status == 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION') { $html .= " <div class='modal' tabindex='-1' role='dialog' id='mo2f-modal2'>\n\t\t<div class='mo2f-modal-backdrop'></div>\n\t\t<div class='modal-dialog'>\n\t\t\t<div class='modal-content'>\n\t\t\t<div class='modal-header'>\n\t\t\t\t<button type='button' class='close' data-dismiss='modal' aria-label='Close' onclick='mologinback();'><span aria-hidden='true'>×</span></button>\n\t\t\t</div>\n\t\t\t\t<div class='modal-body center'>"; if (isset($_SESSION['mo2f-login-message']) && $_SESSION['mo2f-login-message'] == 'Error:OTP over Email') { $html .= "\n\t\t\t<div id='otpMessage'> \n\t\t\t\t<p class='mo2fa_display_message_frontend'>Error occurred while sending OTP over email. Please try again. </p>\n\t\t\t</div>";
public function mo_get_login_form_shortcode($atts) { if (!is_user_logged_in() && mo2f_is_customer_registered()) { $mo2f_shorcode = new MO2F_ShortCode(); $html = $mo2f_shorcode->mo2FALoginFormShortCode($atts); return $html; } }
function mo_2_factor_register($current_user) { if (mo_2factor_is_curl_installed() == 0) { ?> <p style="color:red;">(Warning: <a href="http://php.net/manual/en/curl.installation.php" target="_blank">PHP CURL extension</a> is not installed or disabled)</p> <?php } $mo2f_active_tab = isset($_GET['mo2f_tab']) ? $_GET['mo2f_tab'] : '2factor_setup'; ?> <div id="tab"> <h2 class="nav-tab-wrapper"> <a href="admin.php?page=miniOrange_2_factor_settings&mo2f_tab=2factor_setup" class="nav-tab <?php echo $mo2f_active_tab == '2factor_setup' ? 'nav-tab-active' : ''; ?> " id="mo2f_tab1"> <?php if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION' || get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') { ?> User Profile <?php } else { ?> Account Setup <?php } ?> </a> <a href="admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mobile_configure" class="nav-tab <?php echo $mo2f_active_tab == 'mobile_configure' ? 'nav-tab-active' : ''; ?> " id="mo2f_tab3">Setup Two-Factor</a> <a href="admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mo2f_login" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_login' ? 'nav-tab-active' : ''; ?> " id="mo2f_tab2">Login Settings</a> <a href="admin.php?page=miniOrange_2_factor_settings&mo2f_tab=advance_option" class="nav-tab <?php echo $mo2f_active_tab == 'advance_option' ? 'nav-tab-active' : ''; ?> " id="mo2f_tab2">Advanced Options</a> <a href="admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mo2f_pricing" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_pricing' ? 'nav-tab-active' : ''; ?> " id="mo2f_tab6">Licensing Plans</a> <a href="admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mo2f_demo" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_demo' ? 'nav-tab-active' : ''; ?> " id="mo2f_tab4">How It Works</a> <a href="admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mo2f_help" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_help' ? 'nav-tab-active' : ''; ?> " id="mo2f_tab5">Help & Troubleshooting</a> </h2> </div> <div class="mo2f_container"> <div id="messages"></div> <table style="width:100%;"> <tr> <td style="width:60%;vertical-align:top;"> <?php /* to update the status of existing customers for adding their user registration status */ if (get_option('mo_2factor_admin_registration_status') == 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' && get_option('mo2f_miniorange_admin') == $current_user->ID) { update_user_meta($current_user->ID, 'mo_2factor_user_registration_with_miniorange', 'SUCCESS'); } /* ----------------------------------------- */ if ($mo2f_active_tab == 'mobile_configure') { $mo2f_second_factor = mo2f_get_activated_second_factor($current_user); mo2f_select_2_factor_method($current_user, $mo2f_second_factor); //Configure 2-Factor tab ?> <script> jQuery(document).ready(function(){ jQuery("#mo2f_support_table").hide(); }); </script> <?php } else { if ($mo2f_active_tab == 'mo2f_help') { unset($_SESSION['mo2f_google_auth']); unset($_SESSION['mo2f_mobile_support']); mo2f_show_help_and_troubleshooting($current_user); //Help & Troubleshooting tab } else { if ($mo2f_active_tab == 'mo2f_demo') { unset($_SESSION['mo2f_google_auth']); unset($_SESSION['mo2f_mobile_support']); show_2_factor_login_demo($current_user); } else { if (current_user_can('manage_options') && $mo2f_active_tab == 'mo2f_login') { unset($_SESSION['mo2f_google_auth']); unset($_SESSION['mo2f_mobile_support']); show_2_factor_login_settings($current_user); //Login Settings tab } else { if (current_user_can('manage_options') && $mo2f_active_tab == 'advance_option') { unset($_SESSION['mo2f_google_auth']); unset($_SESSION['mo2f_mobile_support']); show_2_factor_advanced_options($current_user); //Login Settings tab } else { if (current_user_can('manage_options') && $mo2f_active_tab == 'mo2f_pricing') { unset($_SESSION['mo2f_google_auth']); unset($_SESSION['mo2f_mobile_support']); show_2_factor_pricing_page($current_user); //Login Settings tab } else { unset($_SESSION['mo2f_google_auth']); unset($_SESSION['mo2f_mobile_support']); if (get_option('mo_2factor_admin_registration_status') == 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' && get_option('mo2f_miniorange_admin') != $current_user->ID) { if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_SUCCESS' || get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_FAILURE') { mo2f_show_user_otp_validation_page(); // OTP over email validation page } else { if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION') { //displaying user profile $mo2f_second_factor = mo2f_get_activated_second_factor($current_user); mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor); } else { if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') { $mo2f_second_factor = mo2f_get_activated_second_factor($current_user); mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor); //displaying user profile } else { show_user_welcome_page($current_user); //Landing page for additional admin for registration } } } } else { if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_SUCCESS' || get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_OTP_DELIVERED_FAILURE') { mo2f_show_otp_validation_page($current_user); // OTP over email validation page for admin } else { if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION') { //displaying user profile $mo2f_second_factor = mo2f_get_activated_second_factor($current_user); mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor); } else { if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') { $mo2f_second_factor = mo2f_get_activated_second_factor($current_user); mo2f_show_instruction_to_allusers($current_user, $mo2f_second_factor); //displaying user profile } else { if (get_user_meta($current_user->ID, 'mo_2factor_user_registration_status', true) == 'MO_2_FACTOR_VERIFY_CUSTOMER') { mo2f_show_verify_password_page(); //verify password page } else { if (!mo2f_is_customer_registered()) { delete_option('password_mismatch'); mo2f_show_new_registration_page($current_user); //new registration page } } } } } } } } } } } } ?> </td> <td style="vertical-align:top;padding-left:1%;" id="mo2f_support_table"> <?php if ($mo2f_active_tab != 'mobile_configure') { echo mo2f_support(); } ?> </td> </tr> </table> </div> <?php }