"miniOrange QR Code Authentication", "miniOrangeSoftToken" => "miniOrange Soft Token", "miniOrangePushNotification" => "miniOrange Push Notification", "GoogleAuthenticator" => "Google Authenticator", "AuthyAuthenticator" => "Authy Authenticator", "SecurityQuestions" => "Security Questions", "EmailVerification" => "Email Verification", "OTPOverSMS" => "OTP Over SMS", "OTPOverEmail" => "OTP Over Email", "EMAIL" => "OTP Over Email", ); $server_2fa_methods = array( "miniOrange QR Code Authentication" => "MOBILE AUTHENTICATION", "miniOrange Soft Token" => "SOFT TOKEN", "miniOrange Push Notification" => "PUSH NOTIFICATIONS", "Google Authenticator" => "GOOGLE AUTHENTICATOR", "Authy Authenticator" => "GOOGLE AUTHENTICATOR", "Security Questions" => "KBA", "Email Verification" => "OUT OF BAND EMAIL", "OTP Over SMS" => "SMS", "EMAIL" => "OTP Over Email", "OTPOverEmail" => "OTP Over Email" ); $server_to_wpdb_2fa_methods = array( "MOBILE AUTHENTICATION" => "miniOrange QR Code Authentication", "SOFT TOKEN" => "miniOrange Soft Token", "PUSH NOTIFICATIONS" => "miniOrange Push Notification", "GOOGLE AUTHENTICATOR" => "Google Authenticator", "KBA" => "Security Questions", "OUT OF BAND EMAIL" => "Email Verification", "SMS" => "OTP Over SMS", "EMAIL" => "OTP Over Email", "OTPOverEmail" => "OTP Over Email", "OTP OVER EMAIL" => "OTP Over Email", ); $methodname = ''; if ( $decode_type == "wpdb" ) { $methodname = isset( $wpdb_2fa_methods[ $selected_2_factor_method ] ) ? $wpdb_2fa_methods[ $selected_2_factor_method ] : $selected_2_factor_method; } elseif ( $decode_type == "server" ) { $methodname = isset( $server_2fa_methods[ $selected_2_factor_method ] ) ? $server_2fa_methods[ $selected_2_factor_method ] : $selected_2_factor_method; } else { $methodname = isset( $server_to_wpdb_2fa_methods[ $selected_2_factor_method ] ) ? $server_to_wpdb_2fa_methods[ $selected_2_factor_method ] : $selected_2_factor_method; } return $methodname; } function molms_create_2fa_form( $user, $category, $auth_methods, $can_display_admin_features = '' ) { global $molms_db_queries; $all_two_factor_methods = array( "miniOrange QR Code Authentication", "miniOrange Soft Token", "miniOrange Push Notification", "Google Authenticator", "Security Questions", "OTP Over SMS", "OTP Over Email", "Authy Authenticator", "Email Verification", "OTP Over SMS and Email", "Hardware Token" ); $two_factor_methods_descriptions = array( "" => "All methods in the FREE Plan in addition to the following methods.", "miniOrange QR Code Authentication" => "Scan the QR code from the account in your miniOrange Authenticator App to login.", "miniOrange Soft Token" => "Enter the soft token from the account in your miniOrange Authenticator App to login.", "miniOrange Push Notification" => "Accept a push notification in your miniOrange Authenticator App to login.", "Google Authenticator" => "Enter the soft token from the account in your Google/Authy/LastPass Authenticator App to login.", "Security Questions" => "Answer the three security questions you had set, to login.", "OTP Over SMS" => "Enter the One Time Passcode sent to your phone to login.", "OTP Over Email" => "Enter the One Time Passcode sent to your email to login.", "Authy Authenticator" => "Enter the soft token from the account in your Authy Authenticator App to login.", "Email Verification" => "Accept the verification link sent to your email to login.", "OTP Over SMS and Email" => "Enter the One Time Passcode sent to your phone and email to login.", "Hardware Token" => "Enter the One Time Passcode on your Hardware Token to login." ); $two_factor_methods_doc = array( "Security Questions" => "https://developers.miniorange.com/docs/security/wordpress/wp-security/step-by-setup-guide-to-set-up-security-question", "Google Authenticator" => "https://developers.miniorange.com/docs/security/wordpress/wp-security/google-authenticator", "miniOrange QR Code Authentication" => "https://developers.miniorange.com/docs/security/wordpress/wp-security/step-by-setup-guide-to-set-up-miniorange-QR-code", "Email Verification" => "", "miniOrange Soft Token" => "https://developers.miniorange.com/docs/security/wordpress/wp-security/step-by-setup-guide-to-set-up-miniorange-soft-token", "miniOrange Push Notification" => "https://developers.miniorange.com/docs/security/wordpress/wp-security/step-by-setup-guide-to-set-up-miniorange-push-notification", "Authy Authenticator" => "", "OTP Over SMS" => "https://developers.miniorange.com/docs/security/wordpress/wp-security/step-by-setup-guide-to-set-up-otp-over-sms", "OTP Over Email" => "", "OTP Over SMS and Email" => "", "Hardware Token" => "", "" => "" ); $two_factor_methods_video = array( "Security Questions" => "https://www.youtube.com/watch?v=pXPqQ047o-0", "Google Authenticator" => "https://www.youtube.com/watch?v=BS6tY-Goa1Q", "miniOrange QR Code Authentication" => "https://www.youtube.com/watch?v=IPYizmgzTd8", "Email Verification" => "https://www.youtube.com/watch?v=OacJWBYx_AE", "miniOrange Soft Token" => "https://www.youtube.com/watch?v=9HV8V4f80k8", "miniOrange Push Notification" => "https://www.youtube.com/watch?v=it_dAhFcxvw", "Authy Authenticator" => "https://www.youtube.com/watch?v=fV-VnC_5Q5c", "OTP Over SMS" => "https://www.youtube.com/watch?v=ag_E1Bmen-c", "OTP Over Email" => "", "OTP Over SMS and Email" => "", "Hardware Token" => "", "" => "" ); $two_factor_methods_EC = array_slice( $all_two_factor_methods, 0, 9 ); $two_factor_methods_NC = array_slice( $all_two_factor_methods, 0, 7 ); if ( MOLMS_IS_ONPREM or $category != 'free_plan' ) { $all_two_factor_methods = array( "Security Questions", "Google Authenticator", "Email Verification", "miniOrange QR Code Authentication", "miniOrange Soft Token", "miniOrange Push Notification", "Authy Authenticator", "OTP Over SMS", "OTP Over Email", "OTP Over SMS and Email", "Hardware Token" ); $two_factor_methods_descriptions = array( "" => "All methods in the FREE Plan in addition to the following methods.", "Security Questions" => "Answer the three security questions you had set, to login.", "Google Authenticator" => "Enter the soft token from the account in your Google/Authy/LastPass Authenticator App to login.", "Email Verification" => "Accept the verification link sent to your email to login.", "miniOrange QR Code Authentication" => "Scan the QR code from the account in your miniOrange Authenticator App to login.", "miniOrange Soft Token" => "Enter the soft token from the account in your miniOrange Authenticator App to login.", "miniOrange Push Notification" => "Accept a push notification in your miniOrange Authenticator App to login.", "Authy Authenticator" => "Enter the soft token from the account in your Authy Authenticator App to login.", "OTP Over SMS" => "Enter the One Time Passcode sent to your phone to login.", "OTP Over Email" => "Enter the One Time Passcode sent to your email to login.", "OTP Over SMS and Email" => "Enter the One Time Passcode sent to your phone and email to login.", "Hardware Token" => "Enter the One Time Passcode on your Hardware Token to login." ); } $is_customer_registered = $molms_db_queries->get_user_detail( 'user_registration_with_miniorange', $user->ID ) == 'SUCCESS' ? true : false; $can_user_configure_2fa_method = $can_display_admin_features || ( ! $can_display_admin_features && $is_customer_registered ); $is_NC = molms_Utility::get_mo2f_db_option( 'mo2f_is_NC', 'get_site_option' ); $is_EC = ! $is_NC; $form = ''; $form .= '

'; for ( $i = 0; $i < count( $auth_methods ); $i ++ ) { $form .= ''; for ( $j = 0; $j < count( $auth_methods[ $i ] ); $j ++ ) { $auth_method = $auth_methods[ $i ][ $j ]; if ( MOLMS_IS_ONPREM and $category == 'free_plan' ) { if ( $auth_method != 'Email Verification' and $auth_method != 'Security Questions' and $auth_method != 'Google Authenticator' and $auth_method != 'miniOrange QR Code Authentication' and $auth_method != 'miniOrange Soft Token' and $auth_method != 'miniOrange Push Notification' and $auth_method != 'OTP Over SMS' and $auth_method != 'OTP Over Email' ) { } } $auth_method_abr = str_replace( ' ', '', $auth_method ); $configured_auth_method = $molms_db_queries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID ); $is_auth_method_selected = ( $configured_auth_method == $auth_method ? true : false ); $is_auth_method_av = false; if ( ( $is_EC && in_array( $auth_method, $two_factor_methods_EC ) ) || ( $is_NC && in_array( $auth_method, $two_factor_methods_NC ) ) ) { $is_auth_method_av = true; } $thumbnail_height = $is_auth_method_av && $category == 'free_plan' ? 190 : 160; $is_image = $auth_method == "" ? 0 : 1; $form .= '
'; } else { $form .= $is_auth_method_selected ? '#48b74b' : '#20b2aa'; $form .= ';border-top:3px solid '; $form .= $is_auth_method_selected ? '#48b74b' : '#20b2aa'; $form .= ';">'; } $form .= '
'; if ( $is_image ) { $form .= ''; } $form .= '
'; switch ( $auth_method ) { case 'Google Authenticator': $form .= ' '; break; case 'Security Questions': $form .= ' '; break; case 'OTP Over SMS': $form .= ' '; break; case 'miniOrange Soft Token': $form .= ' '; break; case 'miniOrange QR Code Authentication': $form .= ' '; break; case 'miniOrange Push Notification': $form .= ' '; break; case 'Email Verification': $form .= ' '; break; case 'Authy Authenticator': $form .= ' '; break; default: { $form .= ""; } break; } $form .= ' ' . esc_html( $auth_method ) . '

' . esc_attr( $two_factor_methods_descriptions[ $auth_method ] ) . '

'; if ( $is_auth_method_av && $category == 'free_plan' ) { $is_auth_method_configured = $molms_db_queries->get_user_detail( 'mo2f_' . esc_attr( $auth_method_abr ) . '_config_status', $user->ID ); if ( ( $auth_method == 'OUT OF BAND EMAIL' or $auth_method == 'OTP Over Email' ) and ! MOLMS_IS_ONPREM ) { $is_auth_method_configured = 1; } $form .= '
'; $check = $is_customer_registered ? true : false; $show = 0; $cloud_methods = array( 'miniOrange QR Code Authentication', 'miniOrange Soft Token', 'miniOrange Push Notification' ); if ( $auth_method == 'Email Verification' || $auth_method == 'Security Questions' || $auth_method == 'Google Authenticator' || $auth_method == 'miniOrange QR Code Authentication' || $auth_method == 'miniOrange Soft Token' || $auth_method == 'miniOrange Push Notification' || $auth_method == 'OTP Over SMS' || $auth_method == 'OTP Over Email' ) { $show = 1; } if ( $check ) { $form .= '