Plugin Directory

Changeset 3825238


Ignore:
Timestamp:
11/26/2026 03:43:53 AM (less than one hour ago)
Author:
miniorangewp
Message:

two factor authentication 6.7.1

Location:
miniorange-2-factor-authentication
Files:
366 added
38 edited

Legend:

Unmodified
Added
Removed
  • miniorange-2-factor-authentication/trunk/class-mo2finit.php

    r3817433 r3825238  
    2222use TwoFA\Handler\Mo2f_VLS;
    2323use TwoFA\Handler\Mo2f_Main_Handler;
     24use TwoFA\Handler\Mo2f_Setup_Shortcode;
    2425use TwoFA\Handler\Mo2f_Whitelabelling;
    2526use TwoFA\Handler\Twofa\Miniorange_Authentication;
    … …  
    7374                        Mo2f_Advance_Settings_Handler::instance();
    7475                        LoginHandler::instance();
     76                        Mo2f_Setup_Shortcode::instance();
    7577                        Mo2f_Digest_Handler::instance();
    7678                        Mo2f_Captcha_Handler::instance();
  • miniorange-2-factor-authentication/trunk/controllers/2faconfigurations/dashboard.php

    r3722859 r3825238  
    77
    88use TwoFA\Helper\Mo2f_Common_Helper;
     9use TwoFA\Helper\MoWpnsConstants;
    910
    1011if ( ! defined( 'ABSPATH' ) ) {
    … …  
    1213}
    1314
    14 global $wp_roles, $mo2fdb_queries, $mo2f_wpns_db_queries, $mo2f_dir_name;
     15global $wp_roles, $mo2fdb_queries, $mo2f_wpns_db_queries, $mo2f_dir_name, $mo2f_onprem_cloud_obj;
    1516
    1617$mo2f_lv_needed = apply_filters( 'mo2f_is_lv_needed', false );
    … …  
    3940
    4041$mo2f_enable_2fa         = get_site_option( 'mo2f_activate_plugin' );
    41 $mo2f_methods_selected   = (array) get_site_option( 'mo2f_auth_methods_for_users', array() );
     42$mo2f_methods_selected   = array();
     43foreach ( $mo2f_onprem_cloud_obj->mo2f_plan_methods() as $mo2f_plan_method => $mo2f_plan_method_details ) {
     44        if ( empty( $mo2f_plan_method_details['crown'] ) ) {
     45                $mo2f_methods_selected[] = MoWpnsConstants::mo2f_convert_method_name( $mo2f_plan_method, 'cap_to_small' );
     46        }
     47}
     48$mo2f_login_report_enabled = 'true' === get_site_option( 'mo2f_enable_login_report' );
    4249$mo2f_change_alerts_on   = get_site_option( 'mo2f_enable_2fa_change_alerts', 1 );
    4350$mo2f_reminder_emails_on = get_site_option( 'mo2f_enable_2fa_reminder_emails' );
  • miniorange-2-factor-authentication/trunk/controllers/twofa/class-mo-2f-ajax.php

    r3817433 r3825238  
    9999                                wp_send_json_error( 'mo2f-ajax' );
    100100                        } else {
    101                                 $auth_name  = isset( $_POST['auth_name'] ) ? sanitize_text_field( wp_unslash( $_POST['auth_name'] ) ) : null;
    102                                 $session_id = isset( $_POST['session_id'] ) ? sanitize_text_field( wp_unslash( $_POST['session_id'] ) ) : null;
    103                                 if ( MoWpnsConstants::MSFT_AUTH === $auth_name ) {
    104                                         $url = isset( $_POST['micro_soft_url'] ) ? sanitize_text_field( wp_unslash( $_POST['micro_soft_url'] ) ) : null;
    105                                 } else {
    106                                         $url = isset( $_POST['g_auth_url'] ) ? sanitize_text_field( wp_unslash( $_POST['g_auth_url'] ) ) : null;
    107                                 }
    108                                 $current_user = wp_get_current_user();
    109                                 update_user_meta( $current_user->ID, 'mo2f_ga_qrCode', $url );
    110101                                wp_send_json_success();
    111 
    112102                        }
    113103                }
    … …  
    281271                        $otp_token = isset( $_POST['code'] ) ? sanitize_text_field( wp_unslash( $_POST['code'] ) ) : null;
    282272                        $ga_secret = isset( $_POST['ga_secret'] ) ? sanitize_text_field( wp_unslash( $_POST['ga_secret'] ) ) : null;
    283 
    284                         $mo2f_onprem_cloud_obj->mo2f_set_gauth_secret( $user_id, $email, $ga_secret );
     273                        if ( empty( $ga_secret ) || empty( $otp_token ) ) {
     274                                wp_send_json_success( 'FAILURE' );
     275                        }
    285276
    286277                        $google_response = json_decode( $mo2f_onprem_cloud_obj->mo2f_validate_google_auth( $email, $otp_token, $ga_secret ), true );
    287                         wp_send_json_success( $google_response['status'] );
     278                        $status          = isset( $google_response['status'] ) ? $google_response['status'] : 'FAILURE';
     279                        if ( 'SUCCESS' === $status ) {
     280                                $mo2f_onprem_cloud_obj->mo2f_set_gauth_secret( $user_id, $email, $ga_secret );
     281                        }
     282                        wp_send_json_success( $status );
    288283                }
    289284                /**
  • miniorange-2-factor-authentication/trunk/handler/class-feedbackhandler.php

    r3621313 r3825238  
    212212                                $error->add( 'empty_username', '<strong>' . __( 'ERROR', 'miniorange-2-factor-authentication' ) . '</strong>: ' . __( 'Invalid Request.', 'miniorange-2-factor-authentication' ) );
    213213                        } else {
    214                                 $plugin_root_path = dirname( plugin_dir_path( __FILE__ ) );
    215                                 $debug_log_path   = $plugin_root_path . DIRECTORY_SEPARATOR . 'logs';
    216                                 $file_name        = 'miniorange_2FA_plugin_debug_log.php';
    217                                 $status           = file_exists( $debug_log_path . DIRECTORY_SEPARATOR . $file_name );
    218                                 $file_system      = new Mo2f_Filesystem();
     214                                $upload_dir     = wp_upload_dir();
     215                                $debug_log_path = trailingslashit( $upload_dir['basedir'] ) . 'miniorange-2-factor-authentication' . DIRECTORY_SEPARATOR . 'logs';
     216                                $file_name      = 'miniorange_2FA_plugin_debug_log.php';
     217                                $status         = empty( $upload_dir['error'] ) && file_exists( $debug_log_path . DIRECTORY_SEPARATOR . $file_name );
     218                                $file_system    = new Mo2f_Filesystem();
    219219                                if ( $status ) {
    220220                                        header( 'Pragma: public' );
  • miniorange-2-factor-authentication/trunk/handler/class-loginhandler.php

    r3817433 r3825238  
    4343                        add_action( 'wp_login', array( $this, 'mo_wpns_login_success' ) );
    4444                        add_action( 'wp_login_failed', array( $this, 'mo_wpns_login_failed' ) );
     45                        add_action( 'admin_post_mo2f_user_optout', array( $this, 'mo2f_handle_user_optout' ) );
    4546
    4647                        if ( get_site_option( 'mo_wpns_activate_recaptcha_for_woocommerce_registration' ) ) {
    … …  
    5253
    5354                /**
    54                  * Shows a short 2FA status note on the WooCommerce "My Account" dashboard.
    55                  *
    56                  * The "Manage two-factor authentication" link points at a wp-admin page.
    57                  * WooCommerce redirects any user without the `edit_posts` capability
    58                  * (e.g. the Customer/Subscriber roles) away from wp-admin entirely by
    59                  * default (WC_Admin::prevent_admin_access()), before our page ever
    60                  * loads -- so linking there for a plain customer is a dead end. Only
    61                  * show the link to users who can actually reach it; everyone else gets
    62                  * the status message without a link that would just bounce them.
     55                 * Shows a short 2FA status note on the WooCommerce "My Account" dashboard,
     56                 * linking to the My Account two-factor tab where the user can set it up or manage it.
    6357                 *
    6458                 * @return void
    … …  
    6963                                return;
    7064                        }
    71                         $main_handler       = new Mo2f_Main_Handler();
    72                         $twofa_required     = $main_handler->mo2f_check_if_twofa_is_enabled( $current_user );
    73                         $can_reach_wp_admin = current_user_can( 'edit_posts' );
    74                         $box_style          = 'margin:0 0 20px;padding:12px 16px;border:1px solid #d9dde1;border-left:4px solid #1f6f64;border-radius:4px;background:#f7faf9;font-size:14px;line-height:1.5;';
    75 
    76                         if ( $twofa_required ) {
    77                                 $message = esc_html__( 'Your account requires two-factor authentication for sign-in.', 'miniorange-2-factor-authentication' );
     65                        global $mo2fdb_queries;
     66                        $main_handler   = new Mo2f_Main_Handler();
     67                        $twofa_required = (bool) $main_handler->mo2f_check_if_twofa_is_enabled( $current_user );
     68                        $twofa_is_setup = $mo2fdb_queries->mo2f_user_has_completed_2fa_setup( $current_user->ID );
     69                        $optin_allowed = (int) get_site_option( 'mo2f_allow_user_optin' ) === 1;
     70                        if ( ! $twofa_required && ! $twofa_is_setup && ! $optin_allowed ) {
     71                                return;
     72                        }
     73                        $box_style = 'margin:0 0 20px;padding:12px 16px;border:1px solid #d9dde1;border-left:4px solid #1f6f64;border-radius:4px;background:#f7faf9;font-size:14px;line-height:1.5;';
     74
     75                        if ( $twofa_is_setup ) {
     76                                $message   = __( 'Two-factor authentication is active on your account.', 'miniorange-2-factor-authentication' );
     77                                $link_text = __( 'Manage two-factor authentication', 'miniorange-2-factor-authentication' );
     78                        } elseif ( $twofa_required ) {
     79                                $message   = __( 'Your account requires two-factor authentication.', 'miniorange-2-factor-authentication' );
     80                                $link_text = __( 'Set up two-factor authentication', 'miniorange-2-factor-authentication' );
    7881                        } else {
    79                                 $message = esc_html__( 'Want extra security? You can turn on optional two-factor authentication for your account.', 'miniorange-2-factor-authentication' );
    80                         }
    81 
    82                         echo '<div class="mo2f-wc-trust-badge" style="' . esc_attr( $box_style ) . '">'
    83                                 . '&#x1F512; ' . $message . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $message is esc_html__() output, escaped at assignment above.
    84 
    85                         if ( $can_reach_wp_admin ) {
    86                                 $account_url = admin_url( 'admin.php?page=mo_2fa_my_account' );
    87                                 echo '<a href="' . esc_url( $account_url ) . '">' . esc_html__( 'Manage two-factor authentication', 'miniorange-2-factor-authentication' ) . '</a>';
    88                         } else {
    89                                 echo esc_html__( 'Contact the site administrator to set this up for your account.', 'miniorange-2-factor-authentication' );
    90                         }
    91 
     82                                $message   = __( 'Want extra security? You can turn on two-factor authentication for your account.', 'miniorange-2-factor-authentication' );
     83                                $link_text = __( 'Turn on two-factor authentication', 'miniorange-2-factor-authentication' );
     84                        }
     85
     86                        echo '<div class="mo2f-wc-trust-badge" style="' . esc_attr( $box_style ) . '">&#x1F512; ' . esc_html( $message ) . ' ';
     87                        if ( ( $twofa_required || $optin_allowed ) && function_exists( 'wc_get_account_endpoint_url' ) ) {
     88                                echo '<a href="' . esc_url( wc_get_account_endpoint_url( Mo2f_Setup_Shortcode::WC_ENDPOINT ) ) . '">' . esc_html( $link_text ) . '</a>';
     89                        }
    9290                        echo '</div>';
    9391                }
    … …  
    133131                        add_action( 'personal_options_update', array( $this, 'user_two_factor_options_update' ), 10, 3 );
    134132                        add_action( 'edit_user_profile_update', array( $this, 'user_two_factor_options_update' ), 10, 3 );
     133                        add_filter( 'login_message', array( $this, 'mo2f_lockout_login_message' ) );
    135134                        global $mo2f_mo_wpns_utility, $mo2f_dir_name;
    136135                        $w_a_f_enabled = get_site_option( 'WAFEnabled' );
    … …  
    196195
    197196                /**
     197                 * Shows the 2FA lockout notice on the login page after a lockout redirect.
     198                 *
     199                 * @param string $message Existing login message.
     200                 * @return string
     201                 */
     202                public function mo2f_lockout_login_message( $message ) {
     203                        if ( ! isset( $_GET['mo2f_locked'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Display-only flag, no action is performed.
     204                                return $message;
     205                        }
     206                        $minutes = (int) ceil( MoWpnsConstants::MO2F_LOGIN_LOCKOUT_DURATION / 60 );
     207                        /* translators: %d: lockout duration in minutes. */
     208                        $text = sprintf( _n( 'Too many incorrect attempts. Two-factor verification is locked for %d minute. Please try again later.', 'Too many incorrect attempts. Two-factor verification is locked for %d minutes. Please try again later.', $minutes, 'miniorange-2-factor-authentication' ), $minutes );
     209                        return $message . '<div id="login_error" class="notice notice-error"><p>' . esc_html( $text ) . '</p></div>';
     210                }
     211
     212                /**
    198213                 * Renders a "Recent Logins" panel on a user's profile page.
    199214                 *
    … …  
    203218                public function mo2f_render_recent_logins_on_profile( $user ) {
    204219                        global $mo2f_dir_name;
    205                         if ( ! current_user_can( 'edit_user', $user->ID ) ) {
     220                        if ( ! current_user_can( 'edit_user', $user->ID ) || 'true' !== get_site_option( 'mo2f_enable_login_report' ) ) {
    206221                                return;
    207222                        }
    … …  
    209224                                include $mo2f_dir_name . 'handler' . DIRECTORY_SEPARATOR . 'user-profile-recent-logins.php';
    210225                        }
     226                }
     227
     228                /**
     229                 * Turns off 2FA for a user who set it up themselves under the self-service setting.
     230                 *
     231                 * @return void
     232                 */
     233                public function mo2f_handle_user_optout() {
     234                        check_admin_referer( 'mo2f-user-optout' );
     235                        $user        = wp_get_current_user();
     236                        $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw( wp_unslash( $_POST['redirect_to'] ) ) : admin_url();
     237                        $redirect_to = wp_validate_redirect( $redirect_to, admin_url() );
     238                        $main        = new Mo2f_Main_Handler();
     239                        if ( ! $main->mo2f_user_can_opt_out( $user ) ) {
     240                                wp_safe_redirect( add_query_arg( 'mo2f_optout', 'denied', $redirect_to ) );
     241                                exit;
     242                        }
     243                        Mo2f_Reconfigure_Link::mo2f_reset_2fa_after_verified_recovery( $user->ID );
     244                        foreach ( array( 'mo2f_secret_ga', 'mo2f_backup_codes', 'mo_backup_code_generated', 'mo2f_user_profile_set' ) as $meta_key ) {
     245                                delete_user_meta( $user->ID, $meta_key );
     246                        }
     247                        wp_safe_redirect( add_query_arg( 'mo2f_optout', 'done', $redirect_to ) );
     248                        exit;
    211249                }
    212250
  • miniorange-2-factor-authentication/trunk/handler/class-mo2f-2fa-settings-handler.php

    r3817433 r3825238  
    297297                        }
    298298                        update_site_option( 'mo2f_admin_login_bypass_2fa', $bypass_on ? 1 : 0 );
     299                        if ( isset( $post['mo2f_allow_user_optin'] ) ) {
     300                                update_site_option( 'mo2f_allow_user_optin', 'true' === sanitize_text_field( wp_unslash( $post['mo2f_allow_user_optin'] ) ) ? 1 : 0 );
     301                        }
    299302                        wp_send_json_success( MoWpnsMessages::mo2f_get_message( MoWpnsMessages::SETTINGS_SAVED_SUCCESSFULLY ) );
    300303                }
  • miniorange-2-factor-authentication/trunk/handler/class-mo2f-admin-action-handler.php

    r3778872 r3825238  
    314314                 */
    315315                public function mo2f_delete_log_file() {
    316                         $plugin_root_path = dirname( plugin_dir_path( __FILE__ ) );
    317                         $debug_log_path   = $plugin_root_path . DIRECTORY_SEPARATOR . 'logs';
    318                         $file_name        = 'miniorange_2FA_plugin_debug_log.php';
    319                         $status           = file_exists( $debug_log_path . DIRECTORY_SEPARATOR . $file_name );
     316                        $upload_dir     = wp_upload_dir();
     317                        $debug_log_path = trailingslashit( $upload_dir['basedir'] ) . 'miniorange-2-factor-authentication' . DIRECTORY_SEPARATOR . 'logs';
     318                        $file_name      = 'miniorange_2FA_plugin_debug_log.php';
     319                        $status         = empty( $upload_dir['error'] ) && file_exists( $debug_log_path . DIRECTORY_SEPARATOR . $file_name );
    320320                        if ( $status ) {
    321321                                wp_delete_file( $debug_log_path . DIRECTORY_SEPARATOR . $file_name );
  • miniorange-2-factor-authentication/trunk/handler/class-mo2f-backup-codes.php

    r3722859 r3825238  
    240240                public function mo2f_get_login_script() {
    241241                        $common_helper = new Mo2f_Common_Helper();
    242                         $script        = '<script>                      jQuery("#mo2f_validate").click(function() {' . $common_helper->mo2f_show_loader() . '
     242                        $script        = '<script>' . $common_helper->mo2f_get_lockout_countdown_js() . 'jQuery("#mo2f_validate").click(function() {' . $common_helper->mo2f_show_loader() . '
    243243                                var nonce = "' . wp_create_nonce( 'mo-two-factor-ajax-nonce' ) . '";
    244244                                var ajaxurl = "' . esc_js( admin_url( 'admin-ajax.php' ) ) . '";
  • miniorange-2-factor-authentication/trunk/handler/class-mo2f-captcha-handler.php

    r3758280 r3825238  
    3838                        add_action( 'login_enqueue_scripts', array( $this, 'mo2f_captcha_enqueue_assets' ) );
    3939                        add_action( 'login_form', array( $this, 'mo2f_render_captcha_widget' ) );
    40                         add_filter( 'authenticate', array( $this, 'mo2f_verify_captcha_on_login' ), 10 );
     40                        add_filter( 'authenticate', array( $this, 'mo2f_verify_captcha_on_login' ), 25 );
    4141                }
    4242
    … …  
    101101
    102102                /**
     103                 * Verifies the CAPTCHA on wp-login.php submissions. Runs after core's password check
     104                 * (priority 20) and overrides its result, so a failed CAPTCHA blocks the login and
     105                 * does not reveal whether the credentials were valid.
     106                 *
    103107                 * @param WP_User|WP_Error|null $user Current authentication result.
    104108                 * @return WP_User|WP_Error|null
    105109                 */
    106110                public function mo2f_verify_captcha_on_login( $user ) {
    107                         if ( $user instanceof WP_User || ! $this->mo2f_is_wp_login_request() ) {
     111                        if ( ! $this->mo2f_is_wp_login_request() || ! isset( $_POST['log'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Only checks whether a login form was submitted.
    108112                                return $user;
    109113                        }
  • miniorange-2-factor-authentication/trunk/handler/class-mo2f-main-handler.php

    r3817433 r3825238  
    758758                                wp_set_auth_cookie( $user_id, ! empty( $user_details['remember'] ) );
    759759                                MO2f_Utility::mo2f_debug_file( 'mo2fa_pass2login - User_Id-' . $user_id . ' auth cookie set, about to redirect via mo2f_redirect_user_to' );
     760                                if ( 'MFA_COMPLETED' === $mo2f_1stfactor_status && apply_filters( 'mo2f_skip_other_2fa_after_login', true, $currentuser ) ) {
     761                                        remove_action( 'wp_login', array( 'WP2FA\Authenticator\Login', 'wp_login' ), 20 );
     762                                }
    760763                                do_action( 'wp_login', $currentuser->user_login, $currentuser ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WordPress core hook.
    761764                                $common_helper->mo2f_redirect_user_to( $currentuser, $redirect_to );
    … …  
    13061309                 */
    13071310                public function mo2f_check_if_twofa_is_enabled( $currentuser ) {
     1311                        if ( $this->mo2f_is_twofa_required_for_user( $currentuser ) ) {
     1312                                return 1;
     1313                        }
     1314                        return self::mo2f_user_has_opted_in( $currentuser->ID ) ? 1 : 0;
     1315                }
     1316
     1317                /**
     1318                 * Checks if the site's 2FA policy (roles, super admin, per-user rules) requires 2FA for this user.
     1319                 *
     1320                 * @param object $currentuser Current user.
     1321                 * @return bool
     1322                 */
     1323                public function mo2f_is_twofa_required_for_user( $currentuser ) {
    13081324                        $roles             = (array) $currentuser->roles;
    13091325                        $twofactor_enabled = 0;
    … …  
    13211337
    13221338                /**
     1339                 * Whether self-service 2FA is allowed and the user has set up 2FA on their own.
     1340                 *
     1341                 * @param int $user_id User id.
     1342                 * @return bool
     1343                 */
     1344                public static function mo2f_user_has_opted_in( $user_id ) {
     1345                        global $mo2fdb_queries;
     1346                        return (int) get_site_option( 'mo2f_allow_user_optin' ) === 1 && $mo2fdb_queries->mo2f_user_has_completed_2fa_setup( $user_id );
     1347                }
     1348
     1349                /**
     1350                 * Whether the current user may turn off 2FA they set up themselves.
     1351                 *
     1352                 * @param object $user User.
     1353                 * @return bool
     1354                 */
     1355                public function mo2f_user_can_opt_out( $user ) {
     1356                        return $user && $user->ID && self::mo2f_user_has_opted_in( $user->ID ) && ! $this->mo2f_is_twofa_required_for_user( $user );
     1357                }
     1358
     1359                /**
     1360                 * Returns the "Turn off two-factor authentication" form for users who opted in.
     1361                 *
     1362                 * @param string $redirect_to Where to return after turning 2FA off.
     1363                 * @return string
     1364                 */
     1365                public function mo2f_get_optout_form_html( $redirect_to ) {
     1366                        $user = wp_get_current_user();
     1367                        if ( ! $this->mo2f_user_can_opt_out( $user ) ) {
     1368                                return '';
     1369                        }
     1370                        return '<form method="post" action="' . esc_url( admin_url( 'admin-post.php' ) ) . '" class="mo2f-optout-form" onsubmit="return confirm(\'' . esc_js( __( 'Turn off two-factor authentication for your account?', 'miniorange-2-factor-authentication' ) ) . '\');">'
     1371                                . '<input type="hidden" name="action" value="mo2f_user_optout" />'
     1372                                . '<input type="hidden" name="redirect_to" value="' . esc_url( $redirect_to ) . '" />'
     1373                                . wp_nonce_field( 'mo2f-user-optout', '_wpnonce', true, false )
     1374                                . '<button type="submit" class="button">' . esc_html__( 'Turn off two-factor authentication', 'miniorange-2-factor-authentication' ) . '</button>'
     1375                                . '</form>';
     1376                }
     1377
     1378                /**
    13231379                 * Removes miniOrange authenticator entries from the database.
    13241380                 *
    … …  
    13411397                 */
    13421398                public function mo2f_start_inline_2fa( $currentuser, $redirect_to, $session_id_encrypt ) {
    1343                         global $mo2fdb_queries;
     1399                        global $mo2fdb_queries, $mo2f_mo_wpns_utility;
     1400                        $lockout_remaining = $mo2f_mo_wpns_utility->mo2f_get_login_lockout_remaining( $currentuser->ID );
     1401                        if ( $lockout_remaining > 0 ) {
     1402                                $login_popup = new Mo2f_Login_Popup();
     1403                                $login_popup->mo2f_show_lockout_page( $lockout_remaining );
     1404                                exit;
     1405                        }
    13441406                        $common_helper = new Mo2f_Common_Helper();
    13451407                        if ( get_user_meta( $currentuser->ID, 'mo2f_user_profile_set', true ) ) {
    … …  
    13991461                 */
    14001462                public function mo2f_select_method_for_login( $currentuser, $mo2f_second_factor, $session_id_encrypt, $redirect_to ) {
     1463                        global $mo2f_mo_wpns_utility;
     1464                        $lockout_remaining = $mo2f_mo_wpns_utility->mo2f_get_login_lockout_remaining( $currentuser->ID );
     1465                        if ( $lockout_remaining > 0 ) {
     1466                                $login_popup = new Mo2f_Login_Popup();
     1467                                $login_popup->mo2f_show_lockout_page( $lockout_remaining );
     1468                                return;
     1469                        }
    14011470                        $inline_popup  = new Mo2f_Common_Helper();
    14021471                        $process_login = $inline_popup->mo2f_get_object( $mo2f_second_factor );
  • miniorange-2-factor-authentication/trunk/handler/class-mo2f-reconfigure-link.php

    r3778872 r3825238  
    260260                        delete_user_meta( $user_id, 'Security Questions' );
    261261                        delete_user_meta( $user_id, 'mo2f_chat_id' );
     262                        delete_user_meta( $user_id, 'mo2f_secret_ga' );
     263                        delete_user_meta( $user_id, 'mo2f_gauth_key' );
     264                        delete_user_meta( $user_id, 'mo2f_ga_qrCode' );
    262265                        $mo2fdb_queries->mo2f_delete_user_details( $user_id );
    263266                        delete_user_meta( $user_id, 'mo2f_2FA_method_to_test' );
  • miniorange-2-factor-authentication/trunk/handler/twofa/class-google-auth-onpremise.php

    r3817433 r3825238  
    7979                 * @return string
    8080                 */
    81                 public function mo2f_create_secret( $secret_length = 16 ) {
     81                public function mo2f_create_secret( $secret_length = 32 ) {
    8282                        $valid_chars = $this->mo2f_get_base32_lookup_table();
    8383                        // Valid secret lengths are 80 to 640 bits.
  • miniorange-2-factor-authentication/trunk/handler/twofa/class-miniorange-authentication.php

    r3817433 r3825238  
    6969                        add_action( 'plugins_loaded', array( $this, 'mo2f_update_db_check' ) );
    7070                        $is_lv_needed = apply_filters( 'mo2f_is_lv_needed', false );
    71                         if ( ( ! $is_lv_needed || get_site_option( 'mo2fa_lk' ) ) && (int) ( MoWpnsUtility::get_mo2f_db_option( 'mo2f_activate_plugin', 'site_option' ) ) === 1 ) {
     71                        if ( ( ! $is_lv_needed || get_site_option( 'mo2fa_lk' ) ) && ( (int) ( MoWpnsUtility::get_mo2f_db_option( 'mo2f_activate_plugin', 'site_option' ) ) === 1 || (int) get_site_option( 'mo2f_allow_user_optin' ) === 1 ) ) {
    7272                                $pass2fa_login = new Miniorange_Password_2Factor_Login();
    7373                                // for shortcode addon.
    … …  
    222222                                update_site_option( 'mo2f_dbversion', MoWpnsConstants::DB_VERSION );
    223223                                $mo2fdb_queries->generate_tables();
     224                        }
     225                        if ( ! get_site_option( 'mo2f_ga_qrcode_meta_purged' ) ) {
     226                                delete_metadata( 'user', 0, 'mo2f_ga_qrCode', '', true );
     227                                update_site_option( 'mo2f_ga_qrcode_meta_purged', 1 );
    224228                        }
    225229                        if ( MO2F_IS_ONPREM ) {
  • miniorange-2-factor-authentication/trunk/handler/twofa/class-miniorange-password-2factor-login.php

    r3722859 r3825238  
    332332                        $details_to_be_updated  = array();
    333333                        $user_details_key_value = array(
    334                                 'mo2f_' . implode( '', explode( ' ', MoWpnsConstants::mo2f_convert_method_name( $twofa_method, 'cap_to_small' ) ) ) . '_config_status' => $config_status,
     334                                'mo2f_' . MoWpnsConstants::mo2f_get_method_slug( $twofa_method ) . '_config_status' => $config_status,
    335335                                'mo2f_configured_2FA_method'          => $twofa_method,
    336336                                'user_registration_with_miniorange'   => $user_registation,
  • miniorange-2-factor-authentication/trunk/handler/twofa/class-mo2f-cloud-onprem-interface.php

    r3722859 r3825238  
    202202
    203203                /**
    204                  * Google Authenticator setup parameters
    205                  *
    206                  * @param object $user wp user.
    207                  * @param string $session_id session id.
    208                  * @return void
    209                  */
    210                 public function mo2f_google_auth_setup( $user, $session_id ) {
    211                         $this->class_object->mo2f_gauth_setup( $user, $session_id );
    212                 }
    213 
    214                 /**
    215204                 * Login flow for push notifications and email verification
    216205                 *
  • miniorange-2-factor-authentication/trunk/handler/twofamethods/class-mo2f-googleauthenticator-handler.php

    r3817433 r3825238  
    6767                                $mo2f_onprem_cloud_obj->mo2f_set_google_authenticator( $user, $this->mo2f_current_method, $gauth_name, $session_id );
    6868                        }
     69                        global $mo2fdb_queries;
    6970                        $ga_secret = MO2f_Utility::mo2f_decrypt_ga_secret( $user->ID, get_user_meta( $user->ID, 'mo2f_secret_ga', true ) );
    70                         $data      = get_user_meta( $user->ID, 'mo2f_ga_qrCode', true );
    71                         global $mo2fdb_queries;
    72                         if ( MO2F_IS_ONPREM ) {
    73                                 if ( ! $ga_secret ) {
    74                                         $ga_secret = $this->mo2f_create_secret();
    75                                         update_user_meta( $user->ID, 'mo2f_secret_ga', MO2f_Utility::mo2f_encrypt_ga_secret( $ga_secret ) );
    76                                 }
    77                                 $email          = $mo2fdb_queries->mo2f_get_user_detail( 'mo2f_user_email', $user->ID );
    78                                 $email          = ( empty( $email ) ) ? $user->user_email : $email;
    79                                 $is_base64_data = ( ! empty( $data ) && ( strpos( $data, '/9j/' ) === 0 || strpos( $data, 'data:image' ) === 0 || strlen( $data ) > 500 ) );
    80                                 if ( empty( $data ) || ! $ga_secret || $is_base64_data ) {
    81                                         $data = $this->mo2f_geturl( $ga_secret, $gauth_name, $email );
    82                                         update_user_meta( $user->ID, 'mo2f_ga_qrCode', $data );
    83                                 }
    84                         } else {
    85                                 if ( ! $ga_secret || empty( $data ) ) {
    86                                         $mo2f_onprem_cloud_obj->mo2f_set_google_authenticator( $user, $this->mo2f_current_method, $gauth_name, $session_id );
    87                                         $ga_secret = MO2f_Utility::mo2f_decrypt_ga_secret( $user->ID, get_user_meta( $user->ID, 'mo2f_secret_ga', true ) );
    88                                         $data      = get_user_meta( $user->ID, 'mo2f_ga_qrCode', true );
    89                                 }
    90                                 if ( $ga_secret ) {
    91                                         $email     = $mo2fdb_queries->mo2f_get_user_detail( 'mo2f_user_email', $user->ID );
    92                                         $email     = ( empty( $email ) ) ? $user->user_email : $email;
    93                                         $is_base64 = ( ! empty( $data ) && ( strpos( $data, '/9j/' ) === 0 || strpos( $data, 'data:image' ) === 0 || ( strlen( $data ) > 500 && strpos( $data, 'otpauth://' ) !== 0 ) ) );
    94                                         if ( empty( $data ) || $is_base64 ) {
    95                                                 $data = $this->mo2f_geturl( $ga_secret, $gauth_name, $email );
    96                                                 update_user_meta( $user->ID, 'mo2f_ga_qrCode', $data );
    97                                         }
    98                                 }
    99                         }
    100                         if ( empty( $data ) || ! $ga_secret ) {
    101                                 $email = $mo2fdb_queries->mo2f_get_user_detail( 'mo2f_user_email', $user->ID );
    102                                 $email = ( empty( $email ) ) ? $user->user_email : $email;
    103                                 if ( ! $ga_secret ) {
    104                                         $ga_secret = $this->mo2f_create_secret();
    105                                         update_user_meta( $user->ID, 'mo2f_secret_ga', MO2f_Utility::mo2f_encrypt_ga_secret( $ga_secret ) );
    106                                 }
    107                                 $data = $this->mo2f_geturl( $ga_secret, $gauth_name, $email );
    108                                 update_user_meta( $user->ID, 'mo2f_ga_qrCode', $data );
    109                         }
     71                        if ( ! $ga_secret ) {
     72                                $ga_secret = $this->mo2f_create_secret();
     73                                update_user_meta( $user->ID, 'mo2f_secret_ga', MO2f_Utility::mo2f_encrypt_ga_secret( $ga_secret ) );
     74                        }
     75                        $email         = $mo2fdb_queries->mo2f_get_user_detail( 'mo2f_user_email', $user->ID );
     76                        $email         = ( empty( $email ) ) ? $user->user_email : $email;
     77                        $data          = $this->mo2f_geturl( $ga_secret, $gauth_name, $email );
    11078                        $microsoft_url = $this->mo2f_geturl( $ga_secret, $gauth_name, '' );
    111                         if ( empty( $data ) ) {
    112                                 $email = $mo2fdb_queries->mo2f_get_user_detail( 'mo2f_user_email', $user->ID );
    113                                 $email = ( empty( $email ) ) ? $user->user_email : $email;
    114                                 $data  = $this->mo2f_geturl( $ga_secret, $gauth_name, $email );
    115                         }
    11679                        wp_register_script( 'mo2f_qr_code_minjs', plugins_url( '/includes/jquery-qrcode/jquery-qrcode.min.js', dirname( __DIR__ ) ), array(), MO2F_VERSION, false );
    11780                        $common_helper = new Mo2f_Common_Helper();
    … …  
    12083                        $common_helper->mo2f_inline_css_and_js();
    12184                        wp_print_scripts( 'mo2f_qr_code_minjs' );
    122                         $html  = '<html>
     85                        $html  = \TwoFA\Helper\Mo2f_Common_Helper::mo2f_doctype() . '<html>
    12386                        <head>  <meta charset="utf-8"/>
    12487                                <meta http-equiv="X-UA-Compatible" content="IE=edge">
    … …  
    214177                                                } else {
    215178                                                        jQuery("#mo2f-otpMessage").css("display","block");
    216                                                         jQuery("#mo2f_gauth_inline_message").text(response.data);
     179                                                        var mo2fGauthMsg = response.data;
     180                                                        if (mo2fGauthMsg && typeof mo2fGauthMsg === "object") {
     181                                                                if ("ACCOUNT_LOCKED" === mo2fGauthMsg.status) {
     182                                                                        if (mo2fGauthMsg.redirect) {
     183                                                                                window.location.href = mo2fGauthMsg.redirect;
     184                                                                                return;
     185                                                                        }
     186                                                                        var mo2fGauthMinutes = Math.ceil((parseInt(mo2fGauthMsg.remaining, 10) || 0) / 60);
     187                                                                        mo2fGauthMsg = "Too many incorrect attempts. Please wait " + mo2fGauthMinutes + " minute" + (1 === mo2fGauthMinutes ? "" : "s") + " before trying again.";
     188                                                                } else {
     189                                                                        mo2fGauthMsg = mo2fGauthMsg.message || "Something went wrong. Please try again.";
     190                                                                }
     191                                                        }
     192                                                        jQuery("#mo2f_gauth_inline_message").text(mo2fGauthMsg);
    217193                                                }
    218194                                        }
    … …  
    230206                 * @return string
    231207                 */
    232                 public function mo2f_create_secret( $secret_length = 16 ) {
     208                public function mo2f_create_secret( $secret_length = 32 ) {
    233209                        $valid_chars = $this->mo2f_get_base32_lookup_table();
    234210                        // Valid secret lengths are 80 to 640 bits.
    … …  
    338314                                $ga_secret = MO2f_Utility::mo2f_decrypt_ga_secret( $user->ID, get_user_meta( $user->ID, 'mo2f_secret_ga', true ) );
    339315                        }
     316                        MO2f_Utility::mo2f_debug_file( 'Google Authenticator validate_otp called. User_Id-' . $user_id . ' Onprem-' . ( MO2F_IS_ONPREM ? '1' : '0' ) . ' Secret_Present-' . ( $ga_secret ? '1' : '0' ) . ' Is_Dashboard-' . ( $current_wp_user->ID ? '1' : '0' ) );
    340317                        if ( MO2f_Utility::mo2f_check_number_length( $otp_token ) ) {
    341318                                $email = $mo2fdb_queries->mo2f_get_user_detail( 'mo2f_user_email', $user->ID );
    … …  
    363340                                        $onpremise_response = json_decode( $gauth_obj->mo2f_verify_code( $ga_secret, $otp_token ), true );
    364341                                        $google_response    = $onpremise_response;
     342                                        $status             = isset( $onpremise_response['status'] ) ? $onpremise_response['status'] : 'UNKNOWN';
     343                                        MO2f_Utility::mo2f_debug_file( 'Google Authenticator onpremise verify_code result. User_Id-' . $user_id . ' Email-' . $email . ' Status-' . $status );
    365344                                }
    366345                                $this->mo2f_process_inline_ga_validate( $google_response, $user_details, $email, $ga_secret, $session_id_encrypt );
    367346                        } else {
    368                                 if ( ! MO2F_IS_ONPREM ) {
    369                                         $user_id = isset( $user_details['user_id'] ) ? $user_details['user_id'] : null;
    370                                         $user    = get_user_by( 'id', $user_id );
    371                                         $email   = ( $user && isset( $user->user_email ) ) ? $user->user_email : '';
    372                                         MO2f_Utility::mo2f_debug_file( 'Error in Google Authenticator validation - Invalid OTP format. User_Id-' . $user_id . ' Email-' . $email . ' OTP-' . $otp_token );
    373                                 }
     347                                $user_id = isset( $user_details['user_id'] ) ? $user_details['user_id'] : null;
     348                                $user    = get_user_by( 'id', $user_id );
     349                                $email   = ( $user && isset( $user->user_email ) ) ? $user->user_email : '';
     350                                MO2f_Utility::mo2f_debug_file( 'Error in Google Authenticator validation - Invalid OTP format. User_Id-' . $user_id . ' Email-' . $email . ' OTP-' . $otp_token );
    374351                                wp_send_json_error( MoWpnsMessages::mo2f_get_message( MoWpnsMessages::ONLY_DIGITS_ALLOWED ) );
    375352                        }
    … …  
    395372                                                return;
    396373                                        }
     374                                        MO2f_Utility::mo2f_debug_file( 'Google Authenticator OTP validated successfully. User_Id-' . $user_id . ' Email-' . $email );
    397375                                        $response = $this->mo2f_update_user_details( $user, $email );
    398376                                        $this->mo2f_process_update_details_response( $response, $user_details, $ga_secret, $session_id );
    … …  
    400378                                        global $mo2f_mo_wpns_utility;
    401379                                        $user_id = isset( $user_details['user_id'] ) ? $user_details['user_id'] : null;
    402                                         if ( ! MO2F_IS_ONPREM ) {
    403                                                 $status  = isset( $google_response['status'] ) ? $google_response['status'] : 'UNKNOWN';
    404                                                 $message = isset( $google_response['message'] ) ? $google_response['message'] : 'No message';
    405                                                 MO2f_Utility::mo2f_debug_file( 'Error in Google Authenticator validation - Invalid OTP. User_Id-' . $user_id . ' Email-' . $email . ' Status-' . $status . ' Message-' . $message );
    406                                         }
     380                                        $status  = isset( $google_response['status'] ) ? $google_response['status'] : 'UNKNOWN';
     381                                        $message = isset( $google_response['message'] ) ? $google_response['message'] : 'No message';
     382                                        MO2f_Utility::mo2f_debug_file( 'Error in Google Authenticator validation - Invalid OTP. User_Id-' . $user_id . ' Email-' . $email . ' Status-' . $status . ' Message-' . $message );
    407383                                        $mo2f_mo_wpns_utility->mo2f_handle_attempt_validation( MoWpnsMessages::mo2f_get_message( MoWpnsMessages::INVALID_OTP ), $user_id );
    408384                                }
    409                         } elseif ( ! MO2F_IS_ONPREM ) {
     385                        } else {
    410386                                        $user_id = isset( $user_details['user_id'] ) ? $user_details['user_id'] : null;
    411387                                        MO2f_Utility::mo2f_debug_file( 'Error in Google Authenticator validation - JSON decode error. User_Id-' . $user_id . ' Email-' . $email . ' Error-' . json_last_error_msg() );
    412388                        }
    413                         if ( ! MO2F_IS_ONPREM ) {
    414                                 $user_id = isset( $user_details['user_id'] ) ? $user_details['user_id'] : null;
    415                                 MO2f_Utility::mo2f_debug_file( 'Error in Google Authenticator validation - Error while validating OTP. User_Id-' . $user_id . ' Email-' . $email );
    416                         }
     389                        $user_id = isset( $user_details['user_id'] ) ? $user_details['user_id'] : null;
     390                        MO2f_Utility::mo2f_debug_file( 'Error in Google Authenticator validation - Error while validating OTP. User_Id-' . $user_id . ' Email-' . $email );
    417391                        wp_send_json_error( MoWpnsMessages::mo2f_get_message( MoWpnsMessages::ERROR_WHILE_VALIDATING_OTP ) );
    418392                }
    … …  
    447421                                        $common_helper = new Mo2f_Common_Helper();
    448422                                        $common_helper->mo2f_update_current_user_status( $session_id );
     423                                        MO2f_Utility::mo2f_debug_file( 'Google Authenticator configured successfully. User_Id-' . $user_id );
    449424                                        wp_send_json_success( $configured_2fa_method . ' has been configured successfully.' );
    450                                 } elseif ( ! MO2F_IS_ONPREM ) {
     425                                } else {
    451426                                                $user_id = isset( $user_details['user_id'] ) ? $user_details['user_id'] : null;
    452427                                                $user    = get_user_by( 'id', $user_id );
    … …  
    456431                                                MO2f_Utility::mo2f_debug_file( 'Error in Google Authenticator update user details - Failed response. User_Id-' . $user_id . ' Email-' . $email . ' Status-' . $status . ' Message-' . $message );
    457432                                }
    458                         } elseif ( ! MO2F_IS_ONPREM ) {
     433                        } else {
    459434                                        $user_id = isset( $user_details['user_id'] ) ? $user_details['user_id'] : null;
    460435                                        $user    = get_user_by( 'id', $user_id );
    … …  
    474449                        global $mo2f_onprem_cloud_obj;
    475450                        delete_user_meta( $user->ID, 'mo2f_user_profile_set' );
    476                         $response = json_decode( $mo2f_onprem_cloud_obj->mo2f_update_user_info( $user->ID, true, MoWpnsConstants::GOOGLE_AUTHENTICATOR, MoWpnsConstants::SUCCESS_RESPONSE, MoWpnsConstants::MO_2_FACTOR_PLUGIN_SETTINGS, true, $email, null ), true );
     451                        $response_raw = $mo2f_onprem_cloud_obj->mo2f_update_user_info( $user->ID, true, MoWpnsConstants::GOOGLE_AUTHENTICATOR, MoWpnsConstants::SUCCESS_RESPONSE, MoWpnsConstants::MO_2_FACTOR_PLUGIN_SETTINGS, true, $email, null );
     452                        $response     = json_decode( $response_raw, true );
     453                        if ( json_last_error() !== JSON_ERROR_NONE ) {
     454                                MO2f_Utility::mo2f_debug_file( 'Google Authenticator mo2f_update_user_info - JSON decode error. User_Id-' . $user->ID . ' Email-' . $email . ' Error-' . json_last_error_msg() . ' Raw_Response-' . $response_raw );
     455                        }
    477456                        return $response;
    478457                }
    … …  
    548527                                $content = json_decode( $mo2f_onprem_cloud_obj->validate_otp_token( $this->mo2f_current_method, $email, $mo2f_transaction_id, $otp_token, $user, $session_id_encrypt ), true );
    549528                        }
     529                        $login_status = isset( $content['status'] ) ? $content['status'] : 'UNKNOWN';
     530                        MO2f_Utility::mo2f_debug_file( 'Google Authenticator login validate_otp_token result. User_Id-' . $user_id . ' Email-' . $email . ' Status-' . $login_status );
    550531                        if ( isset( $content['status'] ) && 0 === strcasecmp( $content['status'], 'SUCCESS' ) ) {
    551532                                $common_helper = new Mo2f_Common_Helper();
  • miniorange-2-factor-authentication/trunk/handler/twofamethods/class-mo2f-passkey-handler.php

    r3817433 r3825238  
    186186                        $inline_helper = new Mo2f_Inline_Popup();
    187187                        $common_helper->mo2f_inline_css_and_js();
    188                         $html  = '<html><head><meta charset="utf-8"/>
     188                        $html  = \TwoFA\Helper\Mo2f_Common_Helper::mo2f_doctype() . '<html><head><meta charset="utf-8"/>
    189189                        <meta http-equiv="X-UA-Compatible" content="IE=edge">
    190190                        <meta name="viewport" content="width=device-width, initial-scale=1">
  • miniorange-2-factor-authentication/trunk/handler/user-profile-2fa.php

    r3722859 r3825238  
    5959
    6060$mo2f_two_factor_methods_descriptions = array(
    61         MoWpnsConstants::GOOGLE_AUTHENTICATOR => 'administrator' === $user->roles[0] ? __( 'Please scan the below QR code using Google Authenticator app.', 'miniorange-2-factor-authentication' ) : sprintf(
     61        MoWpnsConstants::GOOGLE_AUTHENTICATOR => 'administrator' === $user->roles[0] ? __( 'Please scan the below QR code using your authenticator app.', 'miniorange-2-factor-authentication' ) : sprintf(
    6262                /* translators: %s: user email */
    63                 __( 'Link to configure Google authenticator method will be sent to %s.', 'miniorange-2-factor-authentication' ),
     63                __( 'Link to configure the authenticator app method will be sent to %s.', 'miniorange-2-factor-authentication' ),
    6464                $user->user_email
    6565        ),
    … …  
    110110wp_enqueue_style( 'mo2f_user-profile_style', $mo2f_main_dir . '/includes/css/user-profile.min.css', array(), MO2F_VERSION );
    111111wp_enqueue_script( 'user-profile-2fa-script', $mo2f_main_dir . '/includes/js/user-profile-twofa.min.js', array(), MO2F_VERSION, false );
    112 $twofa_heading  = __( 'Set-up 2FA method for ', 'miniorange-2-factor-authentication' );
    113 $twofa_heading .= $mo2f_userid === $user->ID ? __( 'yourself', 'miniorange-2-factor-authentication' ) : $user->user_login;
     112$mo2f_is_setup = ! empty( $mo2f_current_method ) && $mo2fdb_queries->mo2f_user_has_completed_2fa_setup( $user->ID );
     113if ( $mo2f_is_setup ) {
     114        $twofa_heading = $mo2f_same_user ? __( 'Two-factor authentication', 'miniorange-2-factor-authentication' ) : sprintf(
     115                /* translators: %s: user login */
     116                __( 'Two-factor authentication for %s', 'miniorange-2-factor-authentication' ),
     117                $user->user_login
     118        );
     119} else {
     120        $twofa_heading  = __( 'Set-up 2FA method for ', 'miniorange-2-factor-authentication' );
     121        $twofa_heading .= $mo2f_userid === $user->ID ? __( 'yourself', 'miniorange-2-factor-authentication' ) : $user->user_login;
     122}
    114123?>
    115124<h3>
    … …  
    118127        <input type="hidden" name="option" value="mo2f_enable_twofactor_userprofile">
    119128        <input type="hidden" id="mo2f_enable_user_profile_2fa_nonce"  name="mo2f_enable_user_profile_2fa_nonce" value="<?php echo esc_attr( wp_create_nonce( 'mo-two-factor-ajax-nonce' ) ); ?>"/>
    120 <table class="form-table" id="mo2fa_form-table-user-profile">
     129<?php if ( $mo2f_is_setup ) : ?>
     130<table class="form-table" id="mo2f-profile-2fa-status">
     131        <tr>
     132                <th style="text-align: left;"><?php esc_html_e( 'Status', 'miniorange-2-factor-authentication' ); ?></th>
     133                <td>
     134                        <span class="dashicons dashicons-yes-alt" style="color:#00a32a;"></span>
     135                        <strong><?php esc_html_e( 'Active', 'miniorange-2-factor-authentication' ); ?></strong> &mdash;
     136                        <?php echo esc_html( MoWpnsConstants::mo2f_convert_method_name( $mo2f_current_method, 'cap_to_small' ) ); ?>
     137                        <button type="button" class="button" id="mo2f-profile-change-method" style="margin-left:12px;"><?php esc_html_e( 'Change method', 'miniorange-2-factor-authentication' ); ?></button>
     138                </td>
     139        </tr>
     140</table>
     141<script>
     142        jQuery( function() {
     143                jQuery( '#mo2f-profile-change-method' ).on( 'click', function() {
     144                        jQuery( '#mo2fa_form-table-user-profile' ).show();
     145                        jQuery( this ).hide();
     146                } );
     147        } );
     148</script>
     149<?php endif; ?>
     150<table class="form-table" id="mo2fa_form-table-user-profile" <?php echo $mo2f_is_setup ? 'style="display:none;"' : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static attribute. ?>>
    121151        <tr>
    122152                <th style="text-align: left;">
  • miniorange-2-factor-authentication/trunk/helper/class-mo2f-common-helper.php

    r3817433 r3825238  
    20042004
    20052005                /**
    2006                  * Get the login script.
    2007                  *
    2008                  * @param string $twofa_method Twofa method.
    2009                  * @return string
    2010                  */
    2011                 public function mo2f_get_login_script( $twofa_method ) {
    2012                         $common_helper = new Mo2f_Common_Helper();
    2013                         $script        = '<script>
    2014                         var twofa_method = "' . esc_js( $twofa_method ) . '";
    2015                         var attemptleft = 3;
     2006                 * Returns the JS for the 2FA lockout countdown (mo2f_start_lockout_countdown).
     2007                 *
     2008                 * @return string
     2009                 */
     2010                public function mo2f_get_lockout_countdown_js() {
     2011                        return '
    20162012                        var mo2fLockoutInterval = null;
    20172013                        function mo2f_start_lockout_countdown(seconds) {
    … …  
    20192015                                var remaining = Math.max(0, parseInt(seconds, 10) || 0);
    20202016                                jQuery("#mo2f_validate, #mo2f_catchy_validate").prop("disabled", true);
    2021                                 jQuery("#mo2fa_softtoken, .mo2f-otp-catchy, #mo2f_answer_1, #mo2f_answer_2").val("").prop("disabled", true);
     2017                                jQuery("#mo2fa_softtoken, .mo2f-otp-catchy, #mo2f_answer_1, #mo2f_answer_2, #mo2f_backup_code").val("").prop("disabled", true);
     2018                                jQuery("a[href=\"#mo2f_backup_option\"]").each(function() { this.style.setProperty("display", "none", "important"); });
    20222019                                var attemptSpan = document.getElementById("mo2f_attempt_span");
    20232020                                if (attemptSpan) { attemptSpan.textContent = "0"; }
    … …  
    20362033                                                clearInterval(mo2fLockoutInterval);
    20372034                                                jQuery("#mo2f_validate, #mo2f_catchy_validate").prop("disabled", false);
    2038                                                 jQuery("#mo2fa_softtoken, .mo2f-otp-catchy, #mo2f_answer_1, #mo2f_answer_2").prop("disabled", false);
     2035                                                jQuery("#mo2fa_softtoken, .mo2f-otp-catchy, #mo2f_answer_1, #mo2f_answer_2, #mo2f_backup_code").prop("disabled", false);
     2036                                                jQuery("a[href=\"#mo2f_backup_option\"]").each(function() { this.style.removeProperty("display"); });
    20392037                                                mo2f_show_message("' . esc_js( __( 'You can try again now. Please enter the OTP.', 'miniorange-2-factor-authentication' ) ) . '");
    20402038                                        } else {
    … …  
    20432041                                }, 1000);
    20442042                        }
     2043                        ';
     2044                }
     2045
     2046                /**
     2047                 * Get the login script.
     2048                 *
     2049                 * @param string $twofa_method Twofa method.
     2050                 * @return string
     2051                 */
     2052                public function mo2f_get_login_script( $twofa_method ) {
     2053                        $common_helper = new Mo2f_Common_Helper();
     2054                        $script        = '<script>
     2055                        var twofa_method = "' . esc_js( $twofa_method ) . '";
     2056                        var attemptleft = 3;
     2057                        ' . $this->mo2f_get_lockout_countdown_js() . '
    20452058                        jQuery("#mo2f_validate").click(function() {
    20462059                                ' . $common_helper->mo2f_show_loader() . '
    … …  
    21042117
    21052118                /**
     2119                 * Returns the HTML5 doctype once per request for the standalone 2FA pages, so they render in standards mode.
     2120                 *
     2121                 * @return string
     2122                 */
     2123                public static function mo2f_doctype() {
     2124                        static $printed = false;
     2125                        if ( $printed || is_admin() ) {
     2126                                return '';
     2127                        }
     2128                        $printed = true;
     2129                        return "<!DOCTYPE html>\n";
     2130                }
     2131
     2132                /**
    21062133                 * This function used to include css and js files.
    21072134                 *
    … …  
    21092136                 */
    21102137                public function mo2f_echo_js_css_files() {
     2138                        echo self::mo2f_doctype(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static doctype.
    21112139
    21122140                        if ( is_user_logged_in() && ! get_site_transient( 'mo2f_page_protection_flow_1' . wp_get_current_user()->ID ) ) {
    … …  
    22252253                        $html .= '<h4 class="mo2f-section-heading">' . esc_html__( '2. Scan the QR code from the Authenticator App.', 'miniorange-2-factor-authentication' ) . '</h4>';
    22262254
    2227                         $html .= '<div class="mo2f-qr-section"><ol>
    2228                                 <div class="mo2f_gauth" id="mo2f_google_auth_qr_code" data-qrcode="' . esc_attr( $data ) . '"></div>
    2229                                 <div class="mo2f_gauth_microsoft" id="mo2f_microsoft_auth_qr_code" data-qrcode="' . esc_attr( $microsoft_url ) . '"></div>
    2230                         </ol></div>';
     2255                        $html .= '<div class="mo2f-qr-section"><ol>';
     2256                        if ( empty( $secret ) ) {
     2257                                $html .= '<p class="mo2f-qr-unavailable">' . esc_html__( 'Something went wrong while generating your setup code. Please close this window and try again.', 'miniorange-2-factor-authentication' ) . '</p>';
     2258                        } else {
     2259                                $html .= '<div class="mo2f_gauth" id="mo2f_google_auth_qr_code" data-qrcode="' . esc_attr( $data ) . '"></div>
     2260                                <div class="mo2f_gauth_microsoft" id="mo2f_microsoft_auth_qr_code" data-qrcode="' . esc_attr( $microsoft_url ) . '"></div>';
     2261                        }
     2262                        $html .= '</ol></div>';
    22312263
    22322264                        $html .= '<div class="mo2f-gauth-otp-container">
    … …  
    22342266                                        <span><b>' . esc_html__( '3. Enter the code from authenticator app:', 'miniorange-2-factor-authentication' ) . '</b></span><br>
    22352267                                        <div class="mo2f-gauth-otp-row">
    2236                                                 <input class="mo2f_table_textbox mo2f-gauth-otp-input" id="google_auth_code" autofocus="true" required="true" type="text" name="google_token" placeholder="' . esc_attr__( 'Enter OTP', 'miniorange-2-factor-authentication' ) . '" />
     2268                                                <input class="mo2f_table_textbox mo2f-gauth-otp-input" id="google_auth_code" autofocus="true" required="true" type="tel" name="google_token" placeholder="' . esc_attr__( 'Enter OTP', 'miniorange-2-factor-authentication' ) . '" />
    22372269                                                <button type="button" name="mo2f_validate_gauth" id="mo2f_save_otp_ga_tour" class="mo2f-save-settings-button mo2f-gauth-otp-button">' . esc_html__( 'Verify', 'miniorange-2-factor-authentication' ) . '</button>
    22382270                                        </div>
    … …  
    22502282                        $html .= '<br></td><td class="mo2f_vertical_line"></td><td class="mo2f_google_authy_step3">';
    22512283
    2252                         $html .= '<div><a href="#mo2f_scanbarcode_a" class="mo2f-gauth-link">' . esc_html__( 'Can\'t scan the QR code? ', 'miniorange-2-factor-authentication' ) . '' . MoWpnsConstants::MO2F_SVG_ARROW_ICON_DROPDOWN . '</a></div>';
    2253 
    2254                         $html .= '<br><div id="mo2f_secret_key" class="mo2f-secret-key-box">
    2255                                 <p class="mo2f-secret-key-text">' . esc_html__( 'Use the secret key below to set up your account in the authenticator app.', 'miniorange-2-factor-authentication' ) . '</p>
     2284                        $html .= '<div id="mo2f_secret_key" class="mo2f-secret-key-box" style="display:block;">
     2285                                <p class="mo2f-secret-key-text">' . esc_html__( 'Can\'t scan the QR code? Enter this key in your authenticator app instead.', 'miniorange-2-factor-authentication' ) . '</p>
    22562286                                <div class="mo2f_google_authy_secret_outer_div mo2f-secret-outer">
    2257                                         <div class="mo2f_google_authy_secret_inner_div mo2f-secret-inner">' . esc_html( $secret ) . '</div>
     2287                                        <div class="mo2f_google_authy_secret_inner_div mo2f-secret-inner" style="font-family:monospace;letter-spacing:1px;">' . esc_html( trim( chunk_split( $secret, 4, ' ' ) ) ) . '</div>
    22582288                                </div>
     2289                                <button type="button" id="mo2f_copy_secret" class="mo2f-reset-settings-button" style="margin-top:8px;">' . esc_html__( 'Copy key', 'miniorange-2-factor-authentication' ) . '</button>
    22592290                        </div>';
    22602291
    … …  
    22772308
    22782309                        $html .= '<script>
    2279                                 jQuery("a[href=\"#mo2f_scanbarcode_a\"]").click(function(e){
    2280                                         jQuery("#mo2f_secret_key").slideToggle();
     2310                                jQuery("#mo2f_copy_secret").click(function(){
     2311                                        var mo2fCopyBtn = jQuery(this);
     2312                                        var mo2fSecret = "' . esc_js( $secret ) . '";
     2313                                        var mo2fCopied = function(){ mo2fCopyBtn.text("' . esc_js( __( 'Copied', 'miniorange-2-factor-authentication' ) ) . '"); setTimeout(function(){ mo2fCopyBtn.text("' . esc_js( __( 'Copy key', 'miniorange-2-factor-authentication' ) ) . '"); }, 2000); };
     2314                                        if (navigator.clipboard && window.isSecureContext) {
     2315                                                navigator.clipboard.writeText(mo2fSecret).then(mo2fCopied);
     2316                                        } else {
     2317                                                var mo2fTmp = jQuery("<textarea>").val(mo2fSecret).appendTo("body").select();
     2318                                                document.execCommand("copy");
     2319                                                mo2fTmp.remove();
     2320                                                mo2fCopied();
     2321                                        }
    22812322                                });
    22822323                                jQuery(document).ready(function () {
    … …  
    23522393                                        });
    23532394               
    2354                                         jQuery(".mo2f_gauth").qrcode({
    2355                                                 "render": "image",
    2356                                                 "size": 120,
    2357                                                 "text": jQuery(".mo2f_gauth").data("qrcode")
    2358                                         });
    2359                                         jQuery(".mo2f_gauth_microsoft").qrcode({
    2360                                                 "render": "image",
    2361                                                 "size": 120,
    2362                                                 "text": jQuery(".mo2f_gauth_microsoft").data("qrcode")
    2363                                         });
     2395                                        try {
     2396                                                jQuery(".mo2f_gauth").qrcode({
     2397                                                        "render": "image",
     2398                                                        "size": 120,
     2399                                                        "text": jQuery(".mo2f_gauth").data("qrcode")
     2400                                                });
     2401                                                jQuery(".mo2f_gauth_microsoft").qrcode({
     2402                                                        "render": "image",
     2403                                                        "size": 120,
     2404                                                        "text": jQuery(".mo2f_gauth_microsoft").data("qrcode")
     2405                                                });
     2406                                        } catch (e) {
     2407                                                jQuery(".mo2f_gauth, .mo2f_gauth_microsoft").html("<p class=\'mo2f-qr-unavailable\'>QR code could not be generated. Please use the secret key below to set up your account manually.</p>");
     2408                                                jQuery("#mo2f_secret_key").show();
     2409                                        }
    23642410               
    23652411                                        jQuery(this).scrollTop(0);
    … …  
    24592505                 */
    24602506                public function mo2f_inline_css_and_js() {
     2507                        echo self::mo2f_doctype(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static doctype.
    24612508
    24622509                        wp_register_style( 'mo2f_bootstrap', plugins_url( 'includes/css/bootstrap.min.css', __DIR__ ), array(), MO2F_VERSION, false );
  • miniorange-2-factor-authentication/trunk/helper/class-mo2f-inline-popup.php

    r3778872 r3825238  
    6767                        $common_helper = new Mo2f_Common_Helper();
    6868                        ?> 
     69                <?php echo \TwoFA\Helper\Mo2f_Common_Helper::mo2f_doctype(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static doctype. ?>
    6970                <html>
    7071                        <head>
    … …  
    328329                public function mo2f_show_generated_backup_codes_inline( $redirect_to, $session_id_encrypt, $codes ) {
    329330                        ?>
     331                        <?php echo \TwoFA\Helper\Mo2f_Common_Helper::mo2f_doctype(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static doctype. ?>
    330332                        <html>
    331333                        <head>
    … …  
    379381                                                                                <input type="submit" name="Generate Codes1" id="codes" class="mo2f-save-settings-button mo2f_backup_codes_download" value="<?php esc_attr_e( 'Download Codes', 'miniorange-2-factor-authentication' ); ?>" />
    380382                                                                        </form>
    381                
     383                                                                        <form onsubmit="return false;" style="display:flex;gap:16px;">
     384                                                                                <button type="button" id="mo2f_copy_backup_codes" class="mo2f-reset-settings-button mo2f_backup_codes_finish"><?php esc_html_e( 'Copy codes', 'miniorange-2-factor-authentication' ); ?></button>
     385                                                                                <button type="button" id="mo2f_print_backup_codes" class="mo2f-reset-settings-button mo2f_backup_codes_finish"><?php esc_html_e( 'Print', 'miniorange-2-factor-authentication' ); ?></button>
     386                                                                        </form>
     387
    382388                                                                        <form name="mo2f_finsh_backup_codes_form" id="mo2f_backto_mo_loginform" method="post" action="<?php echo esc_url( wp_login_url() ); ?>">
    383389                                                                                <input type="hidden" name="option" value="mo2f_finish_inline_and_login" />
    … …  
    408414                                                jQuery('#mo2f_backto_mo_loginform').submit();
    409415                                        }
     416                                        var mo2fBackupCodes = <?php echo wp_json_encode( array_values( $codes ) ); ?>;
     417                                        jQuery('#mo2f_copy_backup_codes').on('click', function() {
     418                                                var btn = jQuery(this), text = mo2fBackupCodes.join('\n');
     419                                                var done = function() { btn.text(<?php echo wp_json_encode( __( 'Copied', 'miniorange-2-factor-authentication' ) ); ?>); setTimeout(function() { btn.text(<?php echo wp_json_encode( __( 'Copy codes', 'miniorange-2-factor-authentication' ) ); ?>); }, 2000); };
     420                                                if (navigator.clipboard && window.isSecureContext) {
     421                                                        navigator.clipboard.writeText(text).then(done);
     422                                                } else {
     423                                                        var tmp = jQuery('<textarea>').val(text).appendTo('body').select();
     424                                                        document.execCommand('copy');
     425                                                        tmp.remove();
     426                                                        done();
     427                                                }
     428                                        });
     429                                        jQuery('#mo2f_print_backup_codes').on('click', function() {
     430                                                var win = window.open('', '_blank', 'width=480,height=640');
     431                                                if (!win) { return; }
     432                                                var doc = win.document;
     433                                                doc.title = <?php echo wp_json_encode( __( 'Backup codes', 'miniorange-2-factor-authentication' ) ); ?>;
     434                                                var h = doc.createElement('h2'); h.textContent = <?php echo wp_json_encode( get_bloginfo( 'name' ) . ' - ' . __( 'Backup codes', 'miniorange-2-factor-authentication' ) ); ?>; doc.body.appendChild(h);
     435                                                var p = doc.createElement('p'); p.textContent = <?php echo wp_json_encode( __( 'Each code can only be used once.', 'miniorange-2-factor-authentication' ) ); ?>; doc.body.appendChild(p);
     436                                                var ol = doc.createElement('ol'); ol.style.fontFamily = 'monospace'; ol.style.fontSize = '16px';
     437                                                mo2fBackupCodes.forEach(function(code) { var li = doc.createElement('li'); li.textContent = code; ol.appendChild(li); });
     438                                                doc.body.appendChild(ol);
     439                                                win.focus(); win.print();
     440                                        });
    410441                                </script>
    411442                        </body>
  • miniorange-2-factor-authentication/trunk/helper/class-mo2f-login-popup.php

    r3817433 r3825238  
    337337                 */
    338338                public function mo_catchy_field() {
    339                         $input      = '<input type="text" id="mo2f-digit-1" class="mo2f-otp-catchy" maxlength="1" placeholder=" " data-next="mo2f-digit-2" />';
     339                        $input      = '<input type="tel" id="mo2f-digit-1" class="mo2f-otp-catchy" maxlength="6" inputmode="numeric" autocomplete="one-time-code" placeholder=" " data-next="mo2f-digit-2" />';
    340340                        $prev_field = 5;
    341341                        for ( $i = 2;$i <= 5;$i++ ) {
    342342                                $next  = $i + 1;
    343343                                $prev  = $i - 1;
    344                                 $input = $input . '<input type="text" id="mo2f-digit-' . $i . '" class="mo2f-otp-catchy" maxlength="1" placeholder=" "  data-next="mo2f-digit-' . $next . '"  data-previous="mo2f-digit-' . $prev . '" />';
     344                                $input = $input . '<input type="tel" id="mo2f-digit-' . $i . '" class="mo2f-otp-catchy" maxlength="1" inputmode="numeric" autocomplete="off" placeholder=" "  data-next="mo2f-digit-' . $next . '"  data-previous="mo2f-digit-' . $prev . '" />';
    345345
    346346                        }
    347                         $input = $input . '<input type="text" id="mo2f-digit-6" class="mo2f-otp-catchy" maxlength="1" placeholder=" " data-previous="mo2f-digit-' . $prev_field . '" />';
     347                        $input = $input . '<input type="tel" id="mo2f-digit-6" class="mo2f-otp-catchy" maxlength="1" inputmode="numeric" autocomplete="off" placeholder=" " data-previous="mo2f-digit-' . $prev_field . '" />';
    348348                        $input = $input . '<input type="text" autocomplete="one-time-code" name="mo2fa_softtoken"
    349349                                                                        placeholder="' . esc_attr__( 'Enter code', 'miniorange-2-factor-authentication' ) . '"
    … …  
    364364                 */
    365365                public function mo2f_twofa_authentication_login_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt, $skeleton_values, $twofa_method, $twofa_flow = 'login_2fa' ) {
     366                        echo \TwoFA\Helper\Mo2f_Common_Helper::mo2f_doctype(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static doctype.
    366367                        echo '
    367368                        <html>
    … …  
    491492                                                });
    492493
     494                                                jQuery("#mo2f-digit-1").on("input", function() {
     495                                                        const value = jQuery(this).val().replace(/\D/g, "");
     496                                                        if (value.length <= 1) {
     497                                                                return;
     498                                                        }
     499                                                        const inputs = jQuery(".mo2f-digit-group input.mo2f-otp-catchy");
     500                                                        for (let i = 0; i < inputs.length; i++) {
     501                                                                inputs.eq(i).val(value[i] || "");
     502                                                        }
     503                                                        if (value.length === inputs.length) {
     504                                                                jQuery("#mo2f_catchy_validate").click();
     505                                                        } else {
     506                                                                inputs.eq(Math.min(value.length, inputs.length - 1)).focus();
     507                                                        }
     508                                                });
     509
    493510
    494511                                                var submitButton = jQuery("#mo2f_catchy_validate");
    … …  
    513530                                        });';
    514531                        $html .= "function mo2f_show_message(response) {
    515                                 var html = '<div id=\"mo2f-otpMessage\"><p class=\"mo2fa_display_message_frontend\">' + response + '</p></div>';
     532                                // response is usually a plain string, but the per-account lockout check
     533                                // (mo2f_get_login_lockout_remaining()) sends back an object instead --
     534                                // {status:'ACCOUNT_LOCKED', remaining: seconds} -- which string-concatenation
     535                                // would otherwise render as the literal text \"[object Object]\".
     536                                var text = response;
     537                                if (response && typeof response === 'object') {
     538                                        if ('ACCOUNT_LOCKED' === response.status) {
     539                                                if (response.redirect) {
     540                                                        window.location.href = response.redirect;
     541                                                        return;
     542                                                }
     543                                                if (typeof mo2f_start_lockout_countdown === 'function') {
     544                                                        mo2f_start_lockout_countdown(response.remaining);
     545                                                        return;
     546                                                }
     547                                                var minutes = Math.ceil((parseInt(response.remaining, 10) || 0) / 60);
     548                                                text = 'Too many incorrect attempts. Please wait ' + minutes + ' minute' + (1 === minutes ? '' : 's') + ' before trying again.';
     549                                        } else {
     550                                                text = response.message || 'Something went wrong. Please try again.';
     551                                        }
     552                                }
     553                                var html = '<div id=\"mo2f-otpMessage\"><p class=\"mo2fa_display_message_frontend\">' + text + '</p></div>';
    516554                                jQuery('#mo2f-otpMessage').remove();
    517555                                jQuery('#mo2f-otpMessagehide').after(html);
    … …  
    609647                                                                                                'title'    => array(),
    610648                                                                                                'maxlength' => array(),
     649                                                                                                'autocomplete' => array(),
     650                                                                                                'inputmode' => array(),
    611651                                                                                                'data-previous' => array(),
    612652                                                                                                'data-next' => array(),
    … …  
    865905                public function mo2fa_prompt_mfa_form_for_user( $configure_array_method, $session_id_encrypt, $redirect_to ) {
    866906                        ?>
     907        <?php echo \TwoFA\Helper\Mo2f_Common_Helper::mo2f_doctype(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static doctype. ?>
    867908        <html>
    868909                        <head>
    … …  
    10141055                        exit;
    10151056                }
     1057
     1058                /**
     1059                 * Shows a full-page "account temporarily locked" response instead of the
     1060                 * normal OTP challenge screen. Reached from the same authenticate-filter
     1061                 * interception point as the OTP challenge itself, so reloading or
     1062                 * re-visiting the login page while locked out shows this directly,
     1063                 * instead of only surfacing on the next OTP submission.
     1064                 *
     1065                 * @param int $remaining Seconds remaining in the lockout.
     1066                 * @return void
     1067                 */
     1068                public function mo2f_show_lockout_page( $remaining ) {
     1069                        $common_helper = new Mo2f_Common_Helper();
     1070                        status_header( 429 );
     1071                        $minutes = (int) ceil( $remaining / 60 );
     1072                        echo \TwoFA\Helper\Mo2f_Common_Helper::mo2f_doctype(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static doctype.
     1073                        echo '
     1074                        <html>
     1075                        <head>
     1076                        <meta http-equiv="X-UA-Compatible" content="IE=edge">
     1077                        <meta name="viewport" content="width=device-width, initial-scale=1">
     1078                        ';
     1079                        $common_helper->mo2f_echo_js_css_files();
     1080                        echo '
     1081                        </head>
     1082                        <body>
     1083                        <div class="mo2f_modal" tabindex="-1" role="dialog">
     1084                        <div class="mo2f-modal-backdrop"></div>
     1085                        <div class="mo_customer_validation-modal-dialog mo_customer_validation-modal-md">
     1086                        <div class="login mo_customer_validation-modal-content">
     1087                                <h4>' . esc_html__( 'Account Temporarily Locked', 'miniorange-2-factor-authentication' ) . '</h4>
     1088                                <hr>
     1089                                <p class="mo2fa_display_message_frontend">' . sprintf(
     1090                                        /* translators: %d: number of minutes remaining */
     1091                                        esc_html__( 'Too many incorrect attempts. Please wait %d minute(s) before trying again.', 'miniorange-2-factor-authentication' ),
     1092                                        (int) $minutes
     1093                                ) . '</p>
     1094                                <a href="' . esc_url( wp_login_url() ) . '" class="mo2f-gauth-link">' . esc_html__( 'Back to the login page', 'miniorange-2-factor-authentication' ) . '</a>
     1095                        </div>
     1096                        </div>
     1097                        </div>
     1098                        </body>
     1099                        </html>';
     1100                        exit;
     1101                }
    10161102        }
    10171103}
  • miniorange-2-factor-authentication/trunk/helper/class-mo2f-menuitems.php

    r3541925 r3825238  
    8181                        // Hide menu for end users when the free seat limit is full; admins must keep access to reset users / upgrade.
    8282                        $mo2f_hide_menu_for_limit = $user_limit_exceeded && ! current_user_can( 'manage_options' );
    83                         if ( ( $flag || current_user_can( 'manage_options' ) ) && ! $mo2f_hide_menu_for_limit ) {
     83                        if ( ( $flag || current_user_can( 'manage_options' ) || (int) get_site_option( 'mo2f_allow_user_optin' ) === 1 ) && ! $mo2f_hide_menu_for_limit ) {
    8484                                add_menu_page(
    8585                                        'miniOrange 2-Factor',
  • miniorange-2-factor-authentication/trunk/helper/class-mocurl.php

    r3758280 r3825238  
    366366                        if ( ! $sent ) {
    367367                                MO2f_Utility::mo2f_debug_file( 'mo2f_send_cloud_email failed for ' . $to_email . ' - customerKey set: ' . ( $customer_key ? 'yes' : 'no' ) . ' - response: ' . $response );
     368
     369                                // Cloud delivery failed -- most commonly because the site isn't
     370                                // registered with miniOrange's cloud (customerKey empty), so every
     371                                // 2FA email (OTP, reconfiguration link, new-IP alert, etc) would
     372                                // otherwise be silently dropped. Fall back to the site's own mail
     373                                // transport instead.
     374                                $headers = array( 'From: ' . $from_name . ' <' . get_option( 'admin_email' ) . '>' );
     375                                if ( $bcc_email ) {
     376                                        $headers[] = 'Bcc: ' . $bcc_email;
     377                                }
     378                                add_filter( 'wp_mail_content_type', array( __CLASS__, 'mo2f_wp_mail_html_content_type' ) );
     379                                $sent = wp_mail( $to_email, $subject, $message, $headers );
     380                                remove_filter( 'wp_mail_content_type', array( __CLASS__, 'mo2f_wp_mail_html_content_type' ) );
     381
     382                                MO2f_Utility::mo2f_debug_file( 'mo2f_send_cloud_email fallback to wp_mail for ' . $to_email . ' - ' . ( $sent ? 'succeeded' : 'failed' ) );
    368383                        }
    369384
    370385                        return $sent;
     386                }
     387
     388                /**
     389                 * wp_mail_content_type callback, added only around the fallback wp_mail()
     390                 * call above so it doesn't change the content type of any other mail sent
     391                 * on the site.
     392                 *
     393                 * @return string
     394                 */
     395                public static function mo2f_wp_mail_html_content_type() {
     396                        return 'text/html';
    371397                }
    372398
  • miniorange-2-factor-authentication/trunk/helper/class-mowpnsconstants.php

    r3817433 r3825238  
    225225                        self::GOOGLE_AUTHENTICATOR => array(
    226226                                'selected_2fa_method'      => self::GOOGLE_AUTHENTICATOR,
    227                                 'test_method_instructions' => 'verification code from the configured account in your Google Authenticator app.',
     227                                'test_method_instructions' => 'verification code from the configured account in your authenticator app.',
    228228                                'option_name'              => 'mo2f_validate_google_authy_test',
    229229                                'nonce_name'               => 'mo2f-validate-google-authy-test-nonce',
    … …  
    249249                 */
    250250                public static $mo2f_cap_to_small = array(
    251                         self::GOOGLE_AUTHENTICATOR   => 'Google Authenticator',
     251                        self::GOOGLE_AUTHENTICATOR   => 'Authenticator App',
    252252                        self::SECURITY_QUESTIONS     => 'Security Questions',
    253253                        self::OUT_OF_BAND_EMAIL      => 'Email Verification',
    … …  
    386386                        }
    387387                }
     388
     389                /**
     390                 * Returns a stable, space-free identifier for a 2FA method, used for
     391                 * things that must never change even if the user-facing display label
     392                 * (mo2f_cap_to_small) is reworded: the authmethods icon filename and
     393                 * every existing user's `mo2f_<slug>_config_status` option name.
     394                 *
     395                 * GOOGLE_AUTHENTICATOR is special-cased because its display label was
     396                 * changed from "Google Authenticator" to "Authenticator App", but the
     397                 * icon file on disk (includes/images/authmethods/GoogleAuthenticator.png)
     398                 * and every already-configured user's option name were not -- deriving
     399                 * the slug from the new label would silently break both for existing
     400                 * installs. Every other method's slug is unaffected since their display
     401                 * labels haven't changed.
     402                 *
     403                 * @param string $method Method name.
     404                 * @return string
     405                 */
     406                public static function mo2f_get_method_slug( $method ) {
     407                        if ( self::GOOGLE_AUTHENTICATOR === $method ) {
     408                                return 'GoogleAuthenticator';
     409                        }
     410                        return str_replace( ' ', '', self::mo2f_convert_method_name( $method, 'cap_to_small' ) );
     411                }
    388412        }
    389413        new MoWpnsConstants();
  • miniorange-2-factor-authentication/trunk/helper/class-mowpnsutility.php

    r3817433 r3825238  
    775775                 */
    776776                public function mo2f_handle_attempt_validation( $error_type, $user_id ) {
    777                         if ( ! $user_id ) {
     777                        if ( ! $user_id || self::mo2f_is_own_logged_in_session( $user_id ) ) {
    778778                                wp_send_json_error( $error_type );
    779779                                return;
    … …  
    786786                                self::mo2f_reset_login_attempts( $user_id );
    787787                                $this->mo2f_set_login_lockout( $user_id );
    788                                 wp_send_json_error(
    789                                         array(
    790                                                 'status'    => MoWpnsConstants::MO2F_ACCOUNT_LOCKED,
    791                                                 'remaining' => MoWpnsConstants::MO2F_LOGIN_LOCKOUT_DURATION,
    792                                         )
     788                                $response = array(
     789                                        'status'    => MoWpnsConstants::MO2F_ACCOUNT_LOCKED,
     790                                        'remaining' => MoWpnsConstants::MO2F_LOGIN_LOCKOUT_DURATION,
    793791                                );
     792                                // Only redirect to a full lockout page pre-login (OTP entry/inline setup
     793                                // right after the password step). An already-logged-in user hitting this
     794                                // from the dashboard setup/test-2FA flow has nowhere useful to be
     795                                // redirected to, so that case keeps the existing in-modal message.
     796                                if ( ! is_user_logged_in() ) {
     797                                        $response['redirect'] = add_query_arg( 'mo2f_locked', '1', wp_login_url() );
     798                                }
     799                                wp_send_json_error( $response );
    794800                        }
    795801                }
    … …  
    885891                 */
    886892                public function mo2f_get_login_lockout_remaining( $user_id ) {
     893                        if ( self::mo2f_is_own_logged_in_session( $user_id ) ) {
     894                                return 0;
     895                        }
    887896                        $locked_until = get_transient( 'mo2f_login_lockout_' . $user_id );
    888897                        if ( $locked_until && $locked_until > time() ) {
    … …  
    891900                        return 0;
    892901                }
     902
     903                /**
     904                 * Checks whether the request comes from the given user's own logged-in session.
     905                 *
     906                 * @param int $user_id User id to check.
     907                 * @return bool
     908                 */
     909                public static function mo2f_is_own_logged_in_session( $user_id ) {
     910                        return $user_id && is_user_logged_in() && get_current_user_id() === (int) $user_id;
     911                }
    893912        }
    894913}
  • miniorange-2-factor-authentication/trunk/helper/mo2f-common-login-onprem-cloud.php

    r3408890 r3825238  
    5353        $mo2f_kba_as_backup_enabled   = get_option( 'mo2f_enable_forgotphone_kba' );
    5454        ?>
     55        <?php echo \TwoFA\Helper\Mo2f_Common_Helper::mo2f_doctype(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static doctype. ?>
    5556        <html>
    5657        <head>
  • miniorange-2-factor-authentication/trunk/includes/css/mo2f-responsive-popup.css

    r3722859 r3825238  
    10251025}
    10261026
    1027 .mo_customer_validation-modal-content .mo2f-save-settings-button:disabled {
     1027.mo_customer_validation-modal-content .mo2f-save-settings-button:disabled,
     1028.mo_customer_validation-modal-content .mo2f-save-settings-button:disabled:hover,
     1029.mo_customer_validation-modal-content .mo2f-save-settings-button:disabled:focus,
     1030.mo_customer_validation-modal-content .mo2f-save-settings-button:disabled:active,
     1031.mo_customer_validation-modal-content #mo2f_catchy_validate:disabled,
     1032.mo_customer_validation-modal-content #mo2f_validate:disabled,
     1033.mo_customer_validation-modal-content #mo2f_save_kba:disabled {
    10281034        background: #a7aaad !important;
    10291035        border-color: #a7aaad !important;
  • miniorange-2-factor-authentication/trunk/includes/js/login-settings.min.js

    r3817433 r3825238  
    4848function handleAjaxrequest(e,o,t){
    4949        mo2f_toggle_loading(t,true);
    50         jQuery.post(e,o,(function(e){
     50        return jQuery.post(e,o,(function(e){
    5151                jQuery("#mo2f_2fa_popup_dashboard").css("display","none");
    5252                mo2f_toggle_loading(t,false);
    … …  
    5555                mo2f_toggle_loading(t,false);
    5656        }));
    57 }function success_msg(e){jQuery("#wpns_nav_message").empty(),jQuery("#wpns_nav_message").append("<div id='notice_div' class='overlay_success' style='z-index:9999'><div class='popup_text'>"+e+"</div></div>"),window.onload=nav_popup()}function error_msg(e){jQuery("#wpns_nav_message").empty(),jQuery("#wpns_nav_message").append("<div id='notice_div' class='overlay_error'><div class='popup_text'>"+e+"</div></div>"),window.onload=nav_popup()}function mo2f_show_specific_twofa_settings(e){jQuery(e).is(":checked")?(jQuery("#"+e.id+"_settings").css("display","flex"),jQuery("#"+e.id+"_save").css("display","flex"),jQuery("#"+e.id+"_settings").slideDown()):(jQuery("#"+e.id+"_settings").slideUp(),jQuery("#"+e.id+"_save").css("display","none"),jQuery("#"+e.id+"_settings").css("display","none"))}function selectAllRoles(e){document.querySelectorAll("#mo2f_role_checkbox").forEach((function(o){const t=o.closest(".mo2f-enable-2fa-roles");t.classList.contains("hidden")||(o.checked=e.checked,e.checked?t.classList.add("mo2f-active-2"):t.classList.remove("mo2f-active-2"))})),e.checked?document.getElementById("mo2f_enable2FA").checked=!0:document.getElementById("mo2f_enable2FA").checked=!1;const o=e.closest(".mo2f-enable-2fa-roles");o&&(e.checked?o.classList.add("mo2f-active-2"):o.classList.remove("mo2f-active-2"))}function updateSelectAll(e){const o=[...document.querySelectorAll("#mo2f_role_checkbox")].every((function(e){return e.checked}));document.getElementById("mo2f_select_all_roles").checked=o,e.checked||(document.getElementById("mo2f_select_all_roles").checked=!1);[...document.querySelectorAll("#mo2f_role_checkbox")].some((function(e){return e.checked}))||(document.getElementById("mo2f_enable2FA").checked=!1);const t=e.closest(".mo2f-enable-2fa-roles");t&&(e.checked?t.classList.add("mo2f-active-2"):t.classList.remove("mo2f-active-2"));const n=document.getElementById("mo2f_select_all_roles");if(n){const e=n.closest(".mo2f-enable-2fa-roles");e&&(o?e.classList.add("mo2f-active-2"):e.classList.remove("mo2f-active-2"))}"function"==typeof updateSelectAllVisibility&&updateSelectAllVisibility()}function mo2f_enable_new_ip_notification(){var e=jQuery("#mo2f_new_ip_login_notification").is(":checked");handleAjaxrequest(ajaxurl,{action:"mo2f_login_settings_ajax",option:"mo2f_new_ip_login_notification",nonce:nonce,is_notification_enabled:e},"#mo2f_new_ip_login_notification")}function mo2fShowLoader(){jQuery("#mo2f_2fa_popup_dashboard").html("<span class='mo2f_loader' id='mo2f_loader'></span>"),jQuery("#mo2f_2fa_popup_dashboard").css("display","block")}function mo2f_save_enable2fa_settings(){
     57}function success_msg(e){jQuery("#wpns_nav_message").empty(),jQuery("#wpns_nav_message").append("<div id='notice_div' class='overlay_success' style='z-index:9999'><div class='popup_text'>"+e+"</div></div>"),window.onload=nav_popup()}function error_msg(e){jQuery("#wpns_nav_message").empty(),jQuery("#wpns_nav_message").append("<div id='notice_div' class='overlay_error'><div class='popup_text'>"+e+"</div></div>"),window.onload=nav_popup()}function mo2f_show_specific_twofa_settings(e){jQuery(e).is(":checked")?(jQuery("#"+e.id+"_settings").css("display","flex"),jQuery("#"+e.id+"_save").css("display","flex"),jQuery("#"+e.id+"_settings").slideDown()):(jQuery("#"+e.id+"_settings").slideUp(),jQuery("#"+e.id+"_save").css("display","none"),jQuery("#"+e.id+"_settings").css("display","none"))}function selectAllRoles(e){document.querySelectorAll("#mo2f_role_checkbox").forEach((function(o){const t=o.closest(".mo2f-enable-2fa-roles");t.classList.contains("hidden")||(o.checked=e.checked,e.checked?t.classList.add("mo2f-active-2"):t.classList.remove("mo2f-active-2"))})),e.checked?document.getElementById("mo2f_enable2FA").checked=!0:document.getElementById("mo2f_enable2FA").checked=!1;const o=e.closest(".mo2f-enable-2fa-roles");o&&(e.checked?o.classList.add("mo2f-active-2"):o.classList.remove("mo2f-active-2"))}function updateSelectAll(e){const o=[...document.querySelectorAll("#mo2f_role_checkbox")].every((function(e){return e.checked}));document.getElementById("mo2f_select_all_roles").checked=o,e.checked||(document.getElementById("mo2f_select_all_roles").checked=!1);[...document.querySelectorAll("#mo2f_role_checkbox")].some((function(e){return e.checked}))||(document.getElementById("mo2f_enable2FA").checked=!1);const t=e.closest(".mo2f-enable-2fa-roles");t&&(e.checked?t.classList.add("mo2f-active-2"):t.classList.remove("mo2f-active-2"));const n=document.getElementById("mo2f_select_all_roles");if(n){const e=n.closest(".mo2f-enable-2fa-roles");e&&(o?e.classList.add("mo2f-active-2"):e.classList.remove("mo2f-active-2"))}"function"==typeof updateSelectAllVisibility&&updateSelectAllVisibility()}function mo2f_enable_new_ip_notification(){var e=jQuery("#mo2f_new_ip_login_notification").is(":checked");handleAjaxrequest(ajaxurl,{action:"mo2f_login_settings_ajax",option:"mo2f_new_ip_login_notification",nonce:nonce,is_notification_enabled:e},"#mo2f_new_ip_login_notification")}function mo2fShowLoader(){jQuery("#mo2f_2fa_popup_dashboard").html("<span class='mo2f_loader' id='mo2f_loader'></span>"),jQuery("#mo2f_2fa_popup_dashboard").css("display","block")}var mo2fEnable2faSaveXhr=null,mo2fEnable2faSavePending=false;
     58function mo2f_save_enable2fa_settings(){
     59        if(mo2fEnable2faSaveXhr){mo2fEnable2faSavePending=true;return;}
    5860        var roles=[];
    5961        jQuery.each(jQuery("input[name='role']:checked"),(function(){roles.push(jQuery(this).val());}));
    … …  
    6971                mo2f_admin_login_bypass_2fa:jQuery("#mo2f_admin_bypass_2fa_login").length?jQuery("#mo2f_admin_bypass_2fa_login").is(":checked")?"true":"false":"false"
    7072        };
    71         handleAjaxrequest(ajaxurl,data,"mo2f_enable2FA");
     73        mo2fEnable2faSaveXhr=handleAjaxrequest(ajaxurl,data,"mo2f_enable2FA");
     74        mo2fEnable2faSaveXhr.always(function(){
     75                mo2fEnable2faSaveXhr=null;
     76                if(mo2fEnable2faSavePending){mo2fEnable2faSavePending=false;mo2f_save_enable2fa_settings();}
     77        });
    7278}
    7379function mo2f_is_whole_number(e){e=jQuery.trim(e);return""!==e&&!isNaN(e)&&parseFloat(e)===Math.floor(parseFloat(e))}
  • miniorange-2-factor-authentication/trunk/miniorange_2_factor_settings.php

    r3817433 r3825238  
    77
    88/**
    9  * Plugin Name: Two-Factor Authentication (2FA) – Passkey & Google Authenticator
     9 * Plugin Name: 2FA (Two-factor authentication) for WP - Google Authenticator & Passkey
    1010 * Plugin URI: https://miniorange.com
    11  * Description: This TFA plugin provides various two-factor authentication methods as an additional layer of security after the default WordPress login. Free plan: unlimited users with Google Authenticator, Email OTP, Security Questions (KBA), and Passkey; premium unlocks SMS/WhatsApp OTP, Authy/LastPass/Microsoft Authenticator, and advanced policies.
    12  * Version: 6.7.0
     11 * Description: WordPress two-factor (2FA) authentication with Google Authenticator, Passkey, Email/SMS OTP, Push Notification. Free for unlimited users.
     12 * Version: 6.7.1
     13 * Requires PHP: 7.0
    1314 * Author: miniOrange
    1415 * Author URI: https://miniorange.com
    … …  
    4546
    4647define( 'MO_HOST_NAME', 'https://login.xecurify.com' );
    47 define( 'MO2F_VERSION', '6.7.0' );
     48define( 'MO2F_VERSION', '6.7.1' );
    4849define( 'MO2F_PLUGIN_URL', ( plugin_dir_url( __FILE__ ) ) );
    4950define( 'MO2F_TEST_MODE', false );
    … …  
    101102                        add_action( 'admin_init', array( $this, 'mo2f_handle_first_setup_nudge_dismiss' ) );
    102103                        add_action( 'admin_init', array( $this, 'mo2f_handle_user_limit_notice_dismiss' ) );
     104                        add_action( 'admin_init', array( $this, 'mo2f_handle_conflicting_2fa_notice_dismiss' ) );
     105                        add_action( 'admin_notices', array( $this, 'mo2f_conflicting_2fa_plugin_notice' ) );
    103106                        add_action( 'admin_init', array( $this, 'mo2f_remove_telegram_otp_method' ) );
    104107                        add_action( 'admin_init', array( $this, 'mo2f_reset_premium_only_2fa_methods' ) );
    … …  
    301304                        update_site_option( 'mo2f_first_setup_nudge_dismissed_at', time() );
    302305                        wp_safe_redirect( remove_query_arg( array( 'mo2f_dismiss_first_setup_nudge', '_wpnonce' ) ) );
     306                        exit;
     307                }
     308
     309                /**
     310                 * Returns the other active two-factor plugins, keyed by plugin file.
     311                 *
     312                 * @return array
     313                 */
     314                private function mo2f_get_conflicting_2fa_plugins() {
     315                        if ( ! function_exists( 'is_plugin_active' ) ) {
     316                                include_once ABSPATH . 'wp-admin/includes/plugin.php';
     317                        }
     318                        $known  = array(
     319                                'wp-2fa/wp-2fa.php'                                  => 'WP 2FA',
     320                                'two-factor/two-factor.php'                          => 'Two Factor',
     321                                'google-authenticator/google-authenticator.php'      => 'Google Authenticator',
     322                                'two-factor-authentication/two-factor-login.php'     => 'Two Factor Authentication',
     323                                'wordfence-login-security/wordfence-login-security.php' => 'Wordfence Login Security',
     324                        );
     325                        $active = array();
     326                        foreach ( $known as $file => $name ) {
     327                                if ( is_plugin_active( $file ) ) {
     328                                        $active[ $file ] = $name;
     329                                }
     330                        }
     331                        return $active;
     332                }
     333
     334                /**
     335                 * Warns administrators when another two-factor plugin is active alongside this one.
     336                 *
     337                 * @return void
     338                 */
     339                public function mo2f_conflicting_2fa_plugin_notice() {
     340                        if ( ! current_user_can( 'manage_options' ) ) {
     341                                return;
     342                        }
     343                        $conflicts = $this->mo2f_get_conflicting_2fa_plugins();
     344                        if ( empty( $conflicts ) || get_site_option( 'mo2f_conflicting_2fa_notice_dismissed' ) === md5( implode( ',', array_keys( $conflicts ) ) ) ) {
     345                                return;
     346                        }
     347                        $dismiss_url = wp_nonce_url( add_query_arg( 'mo2f_dismiss_conflicting_2fa_notice', '1' ), 'mo2f-dismiss-conflicting-2fa-notice' );
     348                        /* translators: %s: comma-separated list of plugin names. */
     349                        $message = sprintf( __( 'miniOrange 2-Factor: %s is also active. Users who complete miniOrange 2FA at login are not prompted again by the other plugin, but the two plugins keep separate policies and settings. We recommend using only one two-factor plugin.', 'miniorange-2-factor-authentication' ), implode( ', ', $conflicts ) );
     350                        echo '<div class="notice notice-warning"><p>' . esc_html( $message ) . ' <a href="' . esc_url( $dismiss_url ) . '">' . esc_html__( 'Dismiss', 'miniorange-2-factor-authentication' ) . '</a></p></div>';
     351                }
     352
     353                /**
     354                 * Persist dismiss action for the conflicting 2FA plugin notice.
     355                 *
     356                 * @return void
     357                 */
     358                public function mo2f_handle_conflicting_2fa_notice_dismiss() {
     359                        if ( ! current_user_can( 'manage_options' ) || ! isset( $_GET['mo2f_dismiss_conflicting_2fa_notice'] ) ) {
     360                                return;
     361                        }
     362                        $nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : '';
     363                        if ( ! wp_verify_nonce( $nonce, 'mo2f-dismiss-conflicting-2fa-notice' ) ) {
     364                                return;
     365                        }
     366                        update_site_option( 'mo2f_conflicting_2fa_notice_dismissed', md5( implode( ',', array_keys( $this->mo2f_get_conflicting_2fa_plugins() ) ) ) );
     367                        wp_safe_redirect( remove_query_arg( array( 'mo2f_dismiss_conflicting_2fa_notice', '_wpnonce' ) ) );
    303368                        exit;
    304369                }
  • miniorange-2-factor-authentication/trunk/onprem/class-mo2f-onprem-setup.php

    r3817433 r3825238  
    283283                }
    284284
    285                 /**
    286                  * Google Authenticator setup
    287                  *
    288                  * @param object $user user object.
    289                  * @param string $session_id session id.
    290                  * @return void
    291                  */
    292                 public function mo2f_gauth_setup( $user, $session_id ) {
    293                         global $mo2fdb_queries;
    294                         include_once dirname( __DIR__ ) . DIRECTORY_SEPARATOR . 'handler' . DIRECTORY_SEPARATOR . 'twofa' . DIRECTORY_SEPARATOR . 'class-google-auth-onpremise.php';
    295                         $gauth_obj        = new Google_auth_onpremise();
    296                         $email            = $mo2fdb_queries->mo2f_get_user_detail( 'mo2f_user_email', $user->ID );
    297                         $onpremise_secret = $gauth_obj->mo2f_create_secret();
    298                         $issuer           = get_site_option( 'mo2f_google_appname', DEFAULT_GOOGLE_APPNAME );
    299                         $url              = $gauth_obj->mo2f_geturl( $onpremise_secret, $issuer, $email );
    300                         update_user_meta( $user->ID, 'mo2f_secret_ga', MO2f_Utility::mo2f_encrypt_ga_secret( $onpremise_secret ) );
    301                         update_user_meta( $user->ID, 'mo2f_ga_qrCode', $url );
    302                 }
    303285                /**
    304286                 * Sends email verification link to the users email.
    … …  
    533515                        $mo2f_google_auth['ga_secret'] = $onpremise_secret;
    534516                        update_user_meta( $current_user->ID, 'mo2f_secret_ga', MO2f_Utility::mo2f_encrypt_ga_secret( $onpremise_secret ) );
    535                         update_user_meta( $current_user->ID, 'mo2f_ga_qrCode', $url );
    536517                }
    537518
  • miniorange-2-factor-authentication/trunk/readme.txt

    r3817433 r3825238  
    1 === Two-Factor Authentication (2FA) – Passkey & Google Authenticator ===
     1=== 2FA (Two-factor authentication) for WP - Google Authenticator & Passkey ===
    22Contributors: twofactor, twofactorauthentication, hsn97, cyberlord92
    3 Tags: 2fa, two-factor-authentication, mfa, passkey, security
     3Tags: 2fa, two factor authentication, authenticator, 2-factor authentication, google authenticator
    44Requires at least: 5.3.0
    55Tested up to: 7.1
    6 Requires PHP: 5.3.0
    7 Stable tag: 6.7.0
     6Requires PHP: 7.0
     7Stable tag: 6.7.1
    88License: Expat
    99License URI: https://plugins.miniorange.com/mit-license
    1010
    11 Free 2FA plugin for unlimited users with Passkey, Google Authenticator, Email/SMS OTP, Push Notification & passwordless login.
     11WordPress two-factor (2FA) authentication with Google Authenticator, Passkey, Email/SMS OTP, Push Notification. Free for unlimited users.
    1212
    1313== Description ==
    1414
    15 ### 2FA (Two-Factor Authentication) for WP
    16 
    17 WordPress websites are frequently targeted by brute force attacks, credential stuffing attacks, phishing attempts, and unauthorized login attempts. Passwords alone are no longer sufficient to protect administrator accounts, customer accounts, and sensitive website data. **Which is exactly why 2FA has become essential.**
    18 
    19 ### What's New in 6.7.0
    20 
    21 - **Minor security fixes.**
    22 - **Custom Login URL (Premium)** — change wp-login.php to a custom slug, with a built-in check so a bad slug can't lock you out.
    23 - **Country/Region (Geo) Blocking (Premium)** — block or allow logins by visitor country.
    24 - **Slack Alerts (Premium)** — webhook notifications on successful/failed logins, IP blocks, geo-blocked visitors, and 2FA resets.
    25 - **Limit Login Attempts (automatic brute-force lockout)** — blocks an IP after too many failed login attempts in a configurable window, for a configurable duration.
    26 - **CIDR notation for IP Range Blocking** — block whole network ranges (e.g. 192.168.1.0/24), alongside the existing start-end format.
    27 - **Gravity Forms registration integration**, alongside WooCommerce, User Registration, Ultimate Member, and Registration Magic.
    28 - Multiple security hardening fixes: corrected session-expiry and clock-drift handling, added missing rate limiting on self-service account recovery, and closed a TOTP replay gap.
    29 - **Network Security tab** — a new home for site-hardening settings:
    30   - **Website Hardening** — Security Headers, Force HTTPS, Hide WordPress Version, Disable Directory Listing, and Block Code Execution in Uploads, each a simple on/off toggle.
    31   - **Trusted Reverse Proxy / CDN IPs** — for sites behind Cloudflare or a load balancer, so IP Blocking and Automatic Lockout read the real visitor IP instead of the proxy's.
    32   - **Mixed Content Detection (Premium, All-Inclusive)** — scans your site for HTTP resources on an HTTPS page.
    33 - **Emergency 2FA kill switch** — a `wp-config.php` constant to disable 2FA enforcement site-wide if you're ever locked out without admin access to undo a setting.
    34 - **Encrypted Google Authenticator secrets** — GA secrets are now encrypted at rest instead of stored in plain text.
    35 - Fixed a login-filter priority conflict that could let other security/membership plugins interfere with 2FA enforcement, and fixed a dead AJAX login code path.
    36 - Fixed a race condition in the failed-login attempt counter, added defensive guards around OTP timing and JSON decoding, and fixed a fatal error in the Duo Security integration.
    37 - Scoped IP Blocking checks to login and XML-RPC requests instead of running on every page load.
    38 - Fixed several untranslatable strings on the 2FA OTP challenge popup.
    39 - Fixed a fatal error on sites where another plugin/theme already declared `mo2f_mail_tem()`.
    40 
    41 ---
    42 
    43 ### Also in recent releases
    44 
    45 - **Disable XML-RPC** — close off xmlrpc.php, a common brute-force and DDoS-amplification target, on sites that don't need it.
    46 - **CAPTCHA on the login screen** — add Google reCAPTCHA v2 or Cloudflare Turnstile to wp-login.php to slow down automated brute-force login attempts.
    47 - **Activity Digest email** — an optional daily/weekly summary of new logins, failed login attempts, and **2FA** resets.
    48 - **Unlimited users on the free plan** — no user cap, no per-seat charge.
    49 - **Passkey (WebAuthn/FIDO2) — free** — passwordless **2FA** with Face ID, Touch ID, Windows Hello, or a hardware security key.
    50 - **Push Notification 2FA (Premium)** — approve the login from your phone with one tap, no code to type.
    51 
    52 The miniOrange **2-Factor Authentication** plugin adds an additional layer of security to WordPress logins by requiring users to verify their identity using a second authentication factor. Even if a password is compromised, unauthorized users cannot access accounts without completing the **2FA** verification process.
    53 
    54 The **2FA** plugin supports multiple **Two-Factor Authentication (2FA)** and **Multi-Factor Authentication (MFA)** methods, including **Google Authenticator**, **Microsoft Authenticator**, **Authy**, **Passkey**, **Email OTP**, **SMS OTP**, **WhatsApp OTP**, **Telegram OTP**, **Push Notification**, backup codes, security questions, and hardware token authentication.
    55 
    56 Whether you manage a **WooCommerce** store, membership website, LMS platform, enterprise portal, educational institution, government website, or agency-managed environment, **2FA** helps secure user accounts and reduce the risk of account compromise.
    57 
    58 The **free** plan supports **unlimited users** with Google Authenticator (TOTP), **Passkey**, Email OTP, and Security Questions. **Premium** adds more 2FA methods (SMS OTP, WhatsApp OTP, **Push Notification**, email verification link, and more), enforcement policies, trusted devices, multisite support, custom branding, and more.
    59 
    60 ---
    61 
    62 ### Why Use 2FA (Two-Factor Authentication)?
    63 
    64 **Protect Administrator Accounts**
    65 Administrator accounts are the primary target of attackers. **2FA** ensures that only verified users can access administrative dashboards.
    66 
    67 **Prevent Unauthorized Access**
    68 Even if passwords are stolen through phishing attacks or data breaches, additional **authentication** requirements help prevent unauthorized access.
    69 
    70 **Improve Login Security**
    71 **MFA** strengthens login security by combining passwords with additional verification methods.
    72 
    73 **Reduce Account Takeover Risks**
    74 **Multi-factor authentication** significantly reduces the likelihood of successful account takeover attempts.
    75 
    76 **Secure WooCommerce Customer Accounts**
    77 Protect customer profiles, order information, payment details, and store management accounts using **WooCommerce Two-Factor Authentication (2FA)**.
    78 
    79 Quick Links:
    80 [Setup Guide](https://plugins.miniorange.com/step-by-step-guide-for-wordpress-2-factor-authentication) |
    81 [Features](https://plugins.miniorange.com/2-factor-authentication-for-wordpress-wp-2fa) |
    82 [Pricing Plans](https://plugins.miniorange.com/2-factor-authentication-for-wordpress-wp-2fa#pricing) |
    83 [Support](https://faq.miniorange.com/)
    84 
    85 ### 2FA Plugin Explained in Minutes
    86 
     15### WordPress 2FA: The Complete Two-Factor Authentication Plugin
     16
     17**WordPress 2FA in minutes: miniOrange 2FA adds two-factor authentication to your login page.** After entering a password, each user confirms it's really them with a second step: a passkey, a 6-digit code from Google Authenticator, or a one-time passcode (OTP) sent by email, SMS, or WhatsApp. A leaked, guessed, or phished password is no longer enough to get in.
     18
     19The plugin is free for unlimited users. It works with WooCommerce, Elementor, Ultimate Member, and custom login forms, and lets you enforce 2-factor authentication for every user or only for selected roles. Use it as simple 2FA, or combine several methods for full multi-factor authentication (MFA).
     20
     21### What's New in 6.7.1
     22
     23- **Minor security fixes.** Recommended update.
     24- **Let users turn on 2FA for themselves** — a new Access Rules option lets users whose role isn't required to use 2FA set it up (and turn it off) on their own.
     25- **Front-end 2FA setup** — new `[mo2f_2fa_setup]` shortcode and a "Two-factor authentication" tab in the WooCommerce My Account page, so customers can set up 2FA without visiting wp-admin.
     26- The Authenticator App secret key is now always shown next to the QR code with a Copy button, and new keys are longer (160-bit).
     27- Copy and Print buttons for backup codes after 2FA setup.
     28- The user profile now shows which 2FA method is active, with a "Change method" button.
     29- One-time code autofill support on the login code boxes.
     30- Administrators are warned when another two-factor plugin is active at the same time.
     31- If email delivery through miniOrange fails, OTP emails now fall back to WordPress mail.
     32- Fixed an "[object Object]" message shown instead of a proper wait message when an account is temporarily locked out during Authenticator App setup or login.
     33- Account lockout during login is now shown as a dedicated page instead of a message inside the login popup.
     34- Added a fallback message if the Authenticator App QR code can't be generated or displayed, so the secret key is still reachable.
     35- OTP input fields now bring up a numeric keypad on mobile.
     36- Renamed "Google Authenticator" to "Authenticator App" in a few places — the method also works with Authy, Microsoft Authenticator, and others.
     37- Fixed the Debug Logs Download and Delete actions looking in the wrong folder, so they always reported "file not found" even though the log existed.
     38- Added more detailed debug logging across the Authenticator App setup/login flow for easier troubleshooting.
     39
     40### Quick Links
     41
     42<a href="https://plugins.miniorange.com/2-factor-authentication-for-wordpress-wp-2fa" target="_blank">Official Website</a> | <a href="https://plugins.miniorange.com/wordpress-two-factor-authentication-setup-guides" target="_blank">Setup Guides</a> | <a href="https://plugins.miniorange.com/2-factor-authentication-for-wordpress-wp-2fa#pricing" target="_blank">Plans & Pricing</a> | <a href="https://plugins.miniorange.com/2-factor-authentication-for-wordpress-wp-2fa#contact-form#demo-form" target="_blank">Book a Demo</a>
     43
     44### Watch: WordPress 2FA Plugin Explained in Minutes
     45
     46A quick overview of how this plugin adds two factor authentication to your WordPress login, and what it can do for your site.
    8747[youtube https://youtu.be/rE-awZZt13Q]
    8848
    89 ---
    90 
    91 ### Passkey 2FA — Free
    92 
    93 **Passkey** replaces the password with a cryptographic key stored on the user's device. Nothing is typed, so nothing can be phished — making Passkey one of the strongest **2FA** methods available today, and it's free in this plugin.
    94 
    95 - Register a **Passkey** from the user profile in seconds
    96 - Works with Face ID, Touch ID, Windows Hello, and Android biometrics
    97 - Works with hardware security keys such as YubiKey, Titan, and SoloKey
    98 - Use **Passkey** as passwordless login or as the second **2FA** step
    99 - Multiple passkeys per user, with backup codes as fallback
    100 - No external calls — **Passkey** verification happens entirely on your own site
    101 
    102 ---
    103 
    104 ### Push Notification 2FA — Premium
    105 
    106 **Push Notification 2FA** sends a login approval request directly to the user's phone. They tap Approve and the login completes — no six-digit code, no SMS delay, no copy-paste. It's one of the fastest **2FA** methods for teams that log in many times a day.
    107 
    108 ---
    109 
    110 ### 2FA Core Features
    111 
    112 miniOrange provides comprehensive **2FA (Two-Factor Authentication)** and **Multi-Factor Authentication (MFA)** capabilities for websites of all sizes.
    113 
    114 ---
    115 
    116 ### Google Authenticator and OTP Authentication for 2FA
    117 
    118 Secure WordPress logins using multiple **2FA** authentication methods:
    119 
    120 - **Google Authenticator** (TOTP-based 2FA)
    121 - **Passkey** Authentication (WebAuthn/FIDO2, passwordless & phishing-resistant)
    122 - **Email OTP** Verification
    123 - Security Questions (KBA)
    124 - Backup Codes
    125 - **Microsoft Authenticator** *(Premium)*
    126 - **Authy Authenticator** *(Premium)*
    127 - **LastPass Authenticator** *(Premium)*
    128 - **SMS OTP** Verification *(Premium)*
    129 - **WhatsApp OTP** Authentication *(Premium)*
    130 - **Telegram OTP** Authentication *(Premium)*
    131 - **Push Notification** Authentication *(Premium)*
    132 - Email Verification Link *(Premium)*
    133 - Hardware Token Authentication *(Premium)*
    134 
    135 ---
    136 
    137 ### 2FA / MFA Policies and User Authentication
    138 
    139 - Enforce **2FA** for all users
    140 - Role-based **authentication** policies
    141 - User-specific **MFA** settings
    142 - Trusted device support
    143 - Grace period configuration
    144 - Backup authentication methods
    145 - Force **2FA** setup on login
    146 
    147 ---
    148 
    149 ### 2FA (Two-Factor Authentication) for WooCommerce
    150 
    151 Protect WooCommerce stores with enhanced login **security** and customer account protection.
    152 
    153 - Secure customer accounts with **WooCommerce 2FA**
    154 - Protect store managers and administrators
    155 - Improve customer **WooCommerce login security**
    156 - Compatible with WooCommerce login and account pages
    157 
    158 ---
    159 
    160 ### Passwordless 2FA Login
    161 
    162 Allow users to securely access WordPress without traditional passwords.
    163 
    164 - **Passkey** passwordless login
    165 - Magic Link Login
    166 - OTP Login (without password)
    167 - Email Verification Login
    168 
    169 ---
    170 
    171 ### Login Security and Account Protection
    172 
    173 Improve overall **login security** using advanced **2FA** controls.
    174 
    175 - Secure user verification
    176 - Trusted device management
    177 - Backup authentication options
    178 - Account recovery methods
    179 - Strong access control policies
    180 - Login reports & IP alerts
    181 - Custom redirects after login
    182 - Custom SMS gateway integration *(Premium)*
    183 - Custom branding & white labeling *(Premium)*
    184 - Multisite support *(Premium)*
    185 
    186 ---
    187 
    188 ### Works with Popular Plugins
    189 
    190 Compatible with:
    191 - WooCommerce
    192 - Elementor
    193 - Ultimate Member
    194 - BuddyPress
    195 - Theme My Login
    196 - LoginPress
    197 - Custom login forms
    198 
    199 ---
     49### Key features of the WordPress 2FA plugin
     50
     51* **Passkeys (Free)** – users sign in with Face ID, Touch ID, Windows Hello, Android biometrics, or a hardware security key. Passkeys are phishing-resistant and verified on your own site, with no external calls.
     52* **Google Authenticator (Free)** – time-based 6-digit codes from the Google Authenticator app. Microsoft Authenticator, Authy, and LastPass Authenticator are supported on Premium.
     53* **Email OTP, security questions and backup codes (Free)** – simple options for users who don't want an authenticator app, plus a way back in if a phone is lost.
     54* **SMS, WhatsApp and Telegram OTP (Premium)** – one-time codes delivered to the user's phone, with support for a custom SMS gateway.
     55* **Push notification and hardware tokens (Premium)** – approve a login with one tap, or use a dedicated hardware token.
     56* **Passwordless login (Free)** – sign in with a passkey, a magic link, or a one-time code instead of a password.
     57* **Role-based 2FA policies (Free)** – require 2FA for all users or selected roles, set grace periods, and force setup at next login.
     58* **WooCommerce 2FA (Free)** – protect store staff and customer accounts on WooCommerce login and account pages.
     59* **Login security (Free)** – limit login attempts, CAPTCHA, custom login URL, geo-blocking, IP blocking, and an option to disable XML-RPC.
     60* **Login reports and alerts (Free)** – recent logins, IP alerts, Slack notifications and an activity digest email. Advanced reporting is available on Premium.
     61* **Built for teams and agencies (Premium)** – trusted devices, custom branding and white-labelling, multisite support and advanced reporting.
     62
     63### Free passkey login
     64
     65Many 2FA plugins limit free users or keep their strongest methods behind an upgrade. Here, passkeys and Google Authenticator are free for every user.
     66A passkey is stored on the user's device and only works on your domain, so it can't be entered on a fake login page or leaked in a data breach. Users register a passkey from their profile, then log in with a fingerprint, face scan or security key. Each user can register several passkeys, with backup codes as a fallback. Passkeys can be used as the second step after a password, or for fully passwordless login.
     67
     68### Google Authenticator for WordPress
     69
     70Google Authenticator is familiar to most users and works offline. Users scan a QR code in the app and enter the 6-digit code to confirm. From then on, each login asks for the current code.
     71Google Authenticator runs entirely on your site, with no calls to external services. Authenticator secrets are stored encrypted, and each code is accepted only once, so a code that has been seen or intercepted can't be reused.
     72
     73### Designed for a smooth 2FA rollout
     74
     75Rolling out 2-factor authentication shouldn't create a flood of support tickets. The plugin is built around how sites actually adopt 2FA:
     76
     771. A setup wizard guides you through choosing and testing your first method.
     782. Require 2FA for administrators and editors first, with a grace period for each role.
     793. When the grace period ends, choose whether to enforce setup or block the login.
     804. Extend 2FA to more roles when you're ready.
     81
     82If a user loses their phone, they can sign in with a backup code or the email verification recovery option, and administrators can reset any user's 2FA from the dashboard. On Premium, trusted devices reduce how often users are asked for a code.
     83
     84### Two-factor authentication for WooCommerce stores
     85
     86Shop manager accounts can see orders, issue refunds and change prices, so they're the accounts most worth protecting. WooCommerce 2FA is free. The Quick Setup screen includes a "Protect Staff, Not Shoppers" preset that turns on 2FA for Administrator, Editor, Author and Shop Manager while leaving customers out, so checkout works exactly as before. You can add customers at any time.
     87
     88### Integrations: WooCommerce, Elementor, Ultimate Member and more
     89
     90Two-factor authentication works on the default WordPress login page and on the login forms of the plugins your site already uses. All integrations are included in the free version:
     91
     92* **WooCommerce** – login and My Account pages, for staff and customers
     93* **Elementor** – login forms built with Elementor
     94* **Ultimate Member** – member login pages
     95* **BuddyPress** – community site logins
     96* **Theme My Login** – themed login pages
     97* **LoginPress** – customized login pages
     98* **Gravity Forms** – integration added in version 6.6.0
     99* **Slack** – alerts for login and security events
     100* **Custom login forms** – theme and custom-built login pages
     101* **Multisite (Premium)** – 2FA across a WordPress multisite network
     102
     103The 2FA plugin is used by WooCommerce stores, membership websites, LMS platforms, enterprise portals, educational institutions, government websites and agencies managing client sites.
     104
     105### Login security included
     106
     1072FA protects against stolen passwords. These features, all included in the free version, reduce the attacks that reach your login page in the first place:
     108
     109* Limit login attempts, with IP lockout after repeated failures
     110* Rate limiting of failed 2FA codes for each account
     111* CAPTCHA on the login form
     112* Custom login URL and option to disable XML-RPC
     113* Geo-blocking and IP/CIDR range blocking
     114* Custom redirects after login
     115* Network Security tab and an emergency kill switch
    200116
    201117### Free vs Premium
    202118
    203 **Free** — unlimited users, **Passkey**, **Google Authenticator** (and other TOTP apps), **Email OTP**, backup codes, security questions, role-based **2FA**, **WooCommerce 2FA**, passwordless login.
    204 
    205 **Premium** — **Push Notification 2FA**, **SMS OTP**, **WhatsApp OTP**, **Telegram OTP**, hardware tokens, trusted devices, custom SMS gateway, custom branding & white-labelling, multisite **2FA**, advanced reporting.
    206 
    207 ---
    208 
    209 ### External Services
    210 
    211 Some **2FA** methods require communication with miniOrange services to send or verify OTP, SMS, email, push, or account-related requests. These services are used only when you configure or use the related **2FA** method.
    212 
    213 **Passkey** and **Google Authenticator** (TOTP) are verified entirely on your own site and make no external calls.
    214 
    215 Service links:
    216 [miniOrange Terms](https://www.miniorange.com/usecases/miniOrange_User_Agreement.pdf) |
    217 [miniOrange Privacy Policy](https://www.miniorange.com/privacypolicy)
    218 
    219 ---
    220 
    221 ### Other Plugins by miniOrange
    222 
    223 **[Secure MCP Server](https://wordpress.org/plugins/miniorange-secure-mcp-server/)** — Turn your WordPress site into a secured MCP (Model Context Protocol) server, so AI agents and assistants can connect to it with proper authentication and access control instead of standing wide open.
    224 
    225 ---
     119**Free**
     120
     121* Unlimited users
     122* Passkey (WebAuthn/FIDO2)
     123* Google Authenticator
     124* Email OTP
     125* Security questions
     126* Backup codes
     127* Passwordless login (passkey, magic link, OTP login)
     128* Role-based 2FA policies, grace periods and setup wizard
     129* WooCommerce 2FA and "Protect Staff, Not Shoppers" preset
     130* Integrations with Elementor, Ultimate Member, BuddyPress, Theme My Login, LoginPress and Gravity Forms
     131* Login security: limit login attempts, CAPTCHA, custom login URL, geo-blocking, IP blocking
     132* Login reports, IP alerts and Slack notifications
     133
     134**Premium**
     135
     136* Everything in Free
     137* Microsoft Authenticator, Authy and LastPass Authenticator
     138* SMS OTP, WhatsApp OTP and Telegram OTP
     139* Push Notification
     140* Hardware tokens
     141* Email verification link
     142* Trusted devices
     143* Custom SMS gateway
     144* Custom branding and white-labelling
     145* Multisite 2FA
     146* Advanced reporting
     147
     148[Compare plans and pricing](https://plugins.miniorange.com/2-factor-authentication-for-wordpress-wp-2fa#pricing)
     149
     150### Need help?
     151
     152Ask in the [support forum](https://wordpress.org/support/plugin/miniorange-2-factor-authentication/), where our team responds quickly. For private or enterprise questions, email **mfasupport@xecurify.com** or use the Contact Support button inside the plugin.
     153
     154* [Step-by-step setup guide](https://plugins.miniorange.com/step-by-step-guide-for-wordpress-2-factor-authentication)
     155* [Knowledge base and FAQs](https://faq.miniorange.com/)
     156
     157### External services
     158
     159Passkeys and authenticator apps such as Google Authenticator run entirely on your website. They make no external calls, and no data is sent to miniOrange when users log in with these methods.
     160When an administrator configures or a user uses SMS, WhatsApp, Telegram, email delivery through miniOrange, or Push Notification, the plugin connects to miniOrange's services to send or verify the one-time code or login request. These services are used only for the 2FA method that requires them.
     161
     162* Terms of Use: https://www.miniorange.com/usecases/miniOrange_User_Agreement.pdf
     163* Privacy Policy: https://www.miniorange.com/privacypolicy
    226164
    227165== Installation ==
    228166
    229 = Install and Configure 2FA =
    230 
    231 **Step 1: Install the 2FA Plugin**
    232 
    233 1. Go to Plugins → Add New
    234 2. Search for **miniOrange 2FA** or **Two Factor Authentication**
    235 3. Click Install and then Activate the plugin
    236 4. Navigate to the miniOrange **2FA** settings page from the WordPress dashboard
    237 
    238 **Step 2: Configure Google Authenticator or OTP Authentication**
    239 
    240 5. Select your preferred **2FA** method — **Google Authenticator**, **Microsoft Authenticator**, **Email OTP**, **SMS OTP**, **WhatsApp OTP**, or **Telegram OTP**
    241 6. Complete the verification process and configure your **two-factor authentication** settings
    242 7. Test your **WordPress Two-Factor Authentication** setup
    243 
    244 **Step 3: Configure WordPress MFA Policies**
    245 
    246 8. Enable **Multi-Factor Authentication** for administrators, editors, customers, or other WordPress user roles
    247 9. Configure role-based **authentication** policies, trusted devices, and backup **2FA** methods
    248 10. Enforce **WordPress 2FA** policies across your website
    249 
    250 **Step 4: Configure WooCommerce Two-Factor Authentication** *(optional)*
    251 
    252 11. Protect WooCommerce customers, store managers, and administrators with additional **2FA** verification
    253 12. Enable **passwordless login** (Magic Link, Email Verification, or OTP Login) if needed
    254 
    255 ---
     1671. In your WordPress dashboard, go to **Plugins > Add New**, search for "miniOrange 2FA" or "Two Factor Authentication", click **Install Now**, then **Activate**.
     1682. Open the miniOrange 2FA settings page from the dashboard.
     1693. Follow the setup wizard to choose a method, such as Passkey, Google Authenticator or Email OTP, and test it on your own account.
     1704. Choose which roles must use 2FA, set grace periods and backup methods, then turn on enforcement.
     1715. Optional: set up WooCommerce 2FA and passwordless login (Magic Link or OTP Login).
    256172
    257173== Frequently Asked Questions ==
    258174
    259 = What is WordPress Two-Factor Authentication? =
    260 **WordPress Two-Factor Authentication (2FA)** is a login security mechanism that requires users to provide two forms of identity verification before access is granted. The miniOrange **2FA** plugin integrates **multi-factor authentication** directly into the WordPress login process, supporting **Passkey**, **Google Authenticator**, **Email OTP**, **SMS OTP**, **WhatsApp OTP**, **Telegram OTP**, and more.
    261 
    262 = Does this plugin support Google Authenticator? =
    263 Yes. The plugin fully supports **Google Authenticator** and all TOTP-based authenticator apps, including **Microsoft Authenticator**, **Authy**, and **LastPass Authenticator**.
    264 
    265 = Does this 2FA plugin support Microsoft Authenticator? =
    266 Yes. The plugin supports **Microsoft Authenticator** and any TOTP-compatible authenticator app for **WordPress two-factor authentication**.
    267 
    268 = Can I enforce 2FA for all users? =
    269 You can choose which roles should require **2FA** and which accounts must complete setup. The **free** plan supports **unlimited users** completing setup with Google Authenticator, Passkey, Email OTP, or Security Questions. **Premium** adds more 2FA methods along with trusted devices, stronger enforcement, and multisite support.
     175= What is two-factor authentication in WordPress? =
     176Two-factor authentication (2FA) adds a second check after the password. Users verify their identity with something they have, such as a phone or security key, or something they are, such as a fingerprint. Someone who only knows the password can't log in.
     177
     178= How do I add 2FA to WordPress? =
     179Install and activate the plugin, then follow the setup wizard. Choose a method, test it on your own account, and select the users or roles that must use 2FA.
     180
     181= Is this WordPress 2FA plugin free? =
     182Yes. The free plan covers unlimited users with Passkey, Google Authenticator, Email OTP, security questions, backup codes, role-based policies, WooCommerce 2FA, and passwordless login. Premium adds SMS, WhatsApp, Telegram, push notifications, trusted devices, custom branding, and multisite support.
     183
     184= Does it support Google Authenticator? =
     185Yes, for free. Users scan a QR code with the Google Authenticator app and enter the 6-digit code when they log in.
     186
     187= Does it support Microsoft Authenticator, Authy, or LastPass Authenticator? =
     188Yes. These apps are supported on Premium.
     189
     190= Does it support passkey login? =
     191Yes, for free. Passkeys use the WebAuthn/FIDO2 standard, so users can sign in with biometrics or a security key, with or without a password.
     192
     193= Can I require 2FA only for administrators? =
     194Yes, for free. Role-based policies let you require 2FA for administrators only, for any other role, or for all users.
     195
     196= Can I require 2FA for WooCommerce staff without affecting checkout? =
     197Yes, for free. The "Protect Staff, Not Shoppers" preset on the Quick Setup screen turns on 2FA for Administrator, Editor, Author, and Shop Manager and leaves customers out. You can add customers manually.
     198
     199= Does it support SMS, WhatsApp or Telegram OTP? =
     200Yes, on Premium. Users receive a one-time code by SMS, WhatsApp or Telegram to complete login.
     201
     202= Does it support Push Notification authentication? =
     203Yes, on Premium. Users approve or deny the login request on their registered phone, with no code to type.
     204
     205= Does it support passwordless login? =
     206Yes, for free. Users can sign in with a passkey, a magic link or a one-time code instead of a password.
    270207
    271208= Does this plugin limit login attempts? =
    272 Yes. Under **Network Security > Limit Login Attempts**, you can block an IP address after a configurable number of failed login attempts within a configurable time window, for a configurable duration -- the same protection offered by dedicated "limit login attempts" plugins. Separately, failed **2FA** code attempts are rate-limited per account, independent of the IP-based lockout.
    273 
    274 = Help, I'm locked out of my site by 2FA! =
    275 If you still have FTP or hosting file-manager access to your site, open `wp-config.php` and add `define( 'MO2F_DISABLE_2FA_ENFORCEMENT', true );` above the line that says `/* That's all, stop editing! */`. This immediately disables 2FA/magic-link enforcement for every user, so you can log in with just your username and password. A warning banner appears in wp-admin for as long as this is set, as a reminder to remove the line again once you've sorted out your account.
    276 
    277 = Does this plugin support Passkey login? =
    278 Yes. **Passkey** authentication is available in the **free** version, letting users sign in using device biometrics (fingerprint, face recognition) or security keys based on the WebAuthn/FIDO2 standard. It provides a fast, passwordless, and phishing-resistant **2FA** experience.
    279 
    280 = Does this plugin support Push Notification authentication? =
    281 Yes, as a **premium** **2FA** method. Users simply approve or deny a **push notification** sent to their registered mobile device to complete login, without manually entering an OTP.
    282 
    283 = Can I enable 2FA for administrators only? =
    284 Yes. The plugin supports role-based **authentication** policies, allowing you to enforce **2FA** exclusively for administrators, editors, or any specific WordPress user role.
    285 
    286 = How do I add 2FA to WordPress? =
    287 Install and activate this plugin, open the miniOrange **2FA** dashboard, choose which users or roles should use **two-factor authentication**, and select a method (**Google Authenticator**, **Email OTP**, **SMS OTP**, and more). The built-in setup wizard walks you through each configuration step.
    288 
    289 = Is WordPress 2FA free with this plugin? =
    290 Yes. The free plan supports **unlimited users** with Google Authenticator, Passkey, Email OTP, and Security Questions. **Premium** unlocks more 2FA methods (SMS, WhatsApp, Push Notification, email verification link, and more) plus trusted devices, custom branding, multisite support, and other advanced **authentication** options.
    291 
    292 = Does this plugin support WooCommerce Two-Factor Authentication? =
    293 Yes. You can protect **WooCommerce** login and related flows so customers and shop staff complete **2FA** verification wherever you enable it. Full **WooCommerce Two-Factor Authentication** is supported.
    294 
    295 = Does this plugin support WhatsApp OTP Authentication? =
    296 Yes. **WhatsApp OTP authentication** is available as a premium **2FA** method. Users receive a one-time password via WhatsApp to complete the **two-factor authentication** process.
    297 
    298 = Does this 2FA plugin support Passwordless Login? =
    299 Yes. The plugin supports **passwordless login** for WordPress, including Magic Link Login, **Email OTP** login, and other verification-based login flows that do not require a traditional password.
    300 
    301 = What is the difference between Two-Factor Authentication and Multi-Factor Authentication? =
    302 **Two-Factor Authentication (2FA)** uses exactly two verification factors: typically a password plus one additional factor. **Multi-Factor Authentication (MFA)** uses two or more factors and is a broader term. The miniOrange plugin supports both **2FA** and **MFA** configurations for WordPress.
    303 
    304 = What if I get locked out? =
    305 You can use backup codes, the email verification recovery option, or disable the plugin via FTP to regain access.
     209Yes, for free. Under Network Security > Limit Login Attempts, you can block an IP after a set number of failed attempts within a time window. Failed 2FA codes are also rate-limited for each account.
     210
     211= What is the difference between 2FA and MFA? =
     2122FA uses exactly two factors, usually a password plus one more. Multi-factor authentication (MFA) uses two or more. The plugin supports both.
    306213
    307214= Is my 2FA data sent to miniOrange's servers? =
    308 Not for every method. **Passkey (WebAuthn/FIDO2)** and the **Authenticator app (TOTP)** are verified entirely on your own site — no data is sent to miniOrange for these two methods. SMS, WhatsApp, Telegram, and Push Notification (Premium methods) route through miniOrange's service, since delivering an SMS, chat message, or push notification requires it.
    309 
    310 = How do you handle security vulnerability reports? =
    311 Every fixed security issue is listed in this plugin's changelog, including the version it shipped in. If you believe you've found a vulnerability, please report it privately to mfasupport@xecurify.com (subject: "Security") rather than disclosing it publicly, so it can be investigated and patched first.
    312 
    313 = Can I require 2FA for my WooCommerce staff without slowing down checkout for customers? =
    314 Yes. The **Quick Setup** screen includes a one-click "Protect Staff, Not Shoppers" preset when WooCommerce is active — it selects Administrator, Editor, Author, and Shop Manager for **2FA**, and leaves the Customer role unchecked so checkout stays frictionless. You can still enable it for customers manually if your store needs that.
    315 
    316 = How does miniOrange 2FA compare to Wordfence's built-in two-factor authentication? =
    317 Wordfence bundles a basic TOTP/Passkey **2FA** option inside its full security suite (firewall, malware scanning, and more). miniOrange is a **2FA** specialist: it supports more methods out of the box (Passkey, Authenticator app, Email OTP, Security Questions free; SMS, WhatsApp, Telegram, Push Notification, and hardware tokens on Premium) without the overhead of a bundled firewall or scanner.
    318 
    319 = How does miniOrange 2FA compare to WP 2FA? =
    320 Both are focused, single-purpose **2FA** plugins. miniOrange supports a wider range of verification methods — including SMS, WhatsApp, Telegram, Push Notification, and hardware tokens on Premium — plus a dedicated WooCommerce "Protect Staff, Not Shoppers" role preset.
    321 
    322 = I'm moving away from Solid Security (formerly iThemes Security) or Kadence Security — will this cover what I need? =
    323 For **two-factor authentication** specifically, yes: role-based enforcement, per-role grace periods with per-role actions (enforce vs. block), backup codes, and account-recovery options are all available without bundling an unrelated site-builder or firewall suite.
    324 
    325 ---
     215Not for Passkey or authenticator apps, which run entirely on your site. SMS, WhatsApp, Telegram and Push Notification use miniOrange's services, because delivering the code requires it.
     216
     217= I already use a security suite with 2FA. Should I switch? =
     218If you need more 2FA methods, role-based enforcement with grace periods, or WooCommerce staff protection, a dedicated 2FA plugin gives you more control. Turn off the 2FA feature in your other plugin so users aren't asked for two codes.
     219
     220= How do I report a security vulnerability? =
     221Email mfasupport@xecurify.com with "Security" in the subject line rather than disclosing it publicly. Fixed security issues are listed in the changelog with the version that resolved them.
     222
     223= I'm locked out because of 2FA. How do I get back in? =
     224First, use a backup code or the email verification recovery option. If neither works and you have FTP or file manager access, add the `MO2F_DISABLE_2FA_ENFORCEMENT` constant to `wp-config.php` above the "stop editing" line. This turns off 2FA enforcement for all users, and a banner in wp-admin reminds you to remove the line once you're back in.
    326225
    327226== Screenshots ==
    328 
    329 1. WordPress Two-Factor (2FA) Authentication Dashboard
    330 2. Google Authenticator setup as Two-step authentication (2FA)
    331 3. miniOrange User Account Details
    332 4. 2-Factor Authentication (2FA) Plugin – Quick Settings
    333 5. Reset User 2FA configuration from the 2FA Plugin
    334 6. Custom Email Templates – Whitelabelling with your Brand | WP 2FA
    335 7. Two-Factor setup for SMS Verification with OTP (WP 2FA Plugin)
    336 8. Test WP 2FA Plugin
     2271. The WordPress 2FA dashboard, where you manage all two factor authentication methods.
     2282. Users set up Google Authenticator by scanning a QR code.
     2293. miniOrange account details.
     2304. Quick settings to require 2FA for selected user roles.
     2315. Reset a user's 2FA configuration if they lose their phone.
     2326. Custom 2FA email templates with your own branding (Premium).
     2337. SMS OTP setup for two-factor authentication (Premium).
     2348. Test any 2FA method on your own account before requiring it.
    337235
    338236== Changelog ==
     237
     238= 6.7.1 =
     239* Minor security fixes.
     240* Feature: Optional setting to let users turn on two-factor authentication for themselves, with a "Turn off" option.
     241* Feature: `[mo2f_2fa_setup]` shortcode and WooCommerce My Account "Two-factor authentication" tab for front-end 2FA setup.
     242* Feature: Copy and Print buttons for backup codes.
     243* Feature: Admin notice when another two-factor plugin is active alongside this one.
     244* Improvement: Authenticator App secret key is always shown with a Copy button; new keys are 160-bit.
     245* Improvement: User profile shows the active 2FA method with a "Change method" button.
     246* Improvement: One-time code autofill support on the login code boxes; backup code option hidden while a lockout is active.
     247* Improvement: OTP emails fall back to WordPress mail if delivery through miniOrange fails.
     248* Improvement: Dashboard lists the available login methods by name and explains when login reporting is turned off.
     249* Fixed: Access Rules role selection could be lost when "Enable 2FA" was toggled just before saving.
     250* Fixed: WooCommerce My Account 2FA notice now reflects whether 2FA is already set up.
     251* Fixed: Broken Authenticator App icon and Test/Configure buttons on the Setup 2FA page.
     252* Fixed: "[object Object]" shown instead of a proper wait message when an account is temporarily locked out during Authenticator App setup or login.
     253* Improvement: Account lockout during login is now shown as a dedicated page instead of a message inside the login popup.
     254* Improvement: Added a fallback message if the Authenticator App QR code can't be generated or displayed, so the secret key is still reachable.
     255* Improvement: OTP input fields now bring up a numeric keypad on mobile.
     256* Improvement: Renamed "Google Authenticator" to "Authenticator App" in a few places, since the method also works with Authy, Microsoft Authenticator, and others.
     257* Fixed: Debug Logs Download and Delete actions looking in the wrong folder, so they always reported "file not found" even though the log existed.
     258* Improvement: Added more detailed debug logging across the Authenticator App setup/login flow for easier troubleshooting.
    339259
    340260= 6.7.0 =
    … …  
    585505== Upgrade Notice ==
    586506
     507= 6.7.1 =
     508* Minor security fixes, self-service 2FA for users, front-end 2FA setup shortcode and WooCommerce tab, and several Authenticator App improvements. Recommended update.
     509
    587510= 6.7.0 =
    588511* Adds a Network Security tab (Website Hardening, Trusted Reverse Proxy support), encrypts Google Authenticator secrets at rest, adds an emergency 2FA kill switch, and fixes several login-security and reliability issues. Recommended update.
  • miniorange-2-factor-authentication/trunk/uninstall.php

    r3408890 r3825238  
    2121}
    2222delete_site_option( 'mo2f_activate_plugin' );
     23delete_site_option( 'mo2f_allow_user_optin' );
    2324delete_site_option( 'mo2f_multi_factor_authentication' );
    2425delete_site_option( 'mo_wpns_transactionId' );
    … …  
    125126$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}mo2f_network_whitelisted_ips" ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.NoCaching -- Ignoring complex schema change query as it is used for tablename.
    126127delete_site_option( 'mo2f_dbversion' );
     128delete_site_option( 'mo2f_ga_qrcode_meta_purged' );
    127129delete_site_option( 'mo_2fa_pnp' );
     130delete_site_option( 'mo2f_conflicting_2fa_notice_dismissed' );
    128131
    129132if ( ! is_multisite() ) {
  • miniorange-2-factor-authentication/trunk/views/2faconfigurations/accessrules.php

    r3817433 r3825238  
    9696                                        </div>
    9797                                        <p class="mo2f-quicksetup-bypass__hint"><?php esc_html_e( 'When enabled, administrators still complete the usual 2FA step, but the login screen adds a recovery link to finish without 2FA if they have trouble.', 'miniorange-2-factor-authentication' ); ?></p>
     98                                </div>
     99                                <?php
     100                                $mo2f_allow_user_optin = (int) get_site_option( 'mo2f_allow_user_optin' );
     101                                ?>
     102                                <div class="mo2f-quicksetup-bypass">
     103                                        <div class="mo2f-enable-2fa-roles mo2f-quicksetup-bypass__pill<?php echo $mo2f_allow_user_optin ? ' mo2f-active-2' : ''; ?>">
     104                                                <input type="checkbox" class="role-checkbox" id="mo2f_allow_user_optin" onchange="this.closest('.mo2f-quicksetup-bypass__pill').classList.toggle('mo2f-active-2', this.checked);" <?php checked( $mo2f_allow_user_optin ); ?> />
     105                                                <label for="mo2f_allow_user_optin"><?php esc_html_e( 'Let users turn on 2FA for themselves', 'miniorange-2-factor-authentication' ); ?></label>
     106                                        </div>
     107                                        <p class="mo2f-quicksetup-bypass__hint"><?php esc_html_e( 'Users in roles that are not required to use 2FA can set it up from the Setup 2FA page, the WooCommerce My Account page or the [mo2f_2fa_setup] shortcode. Once a user has set up 2FA, it is required at their every login until they turn it off.', 'miniorange-2-factor-authentication' ); ?></p>
    98108                                </div>
    99109                        </div>
    … …  
    222232        wp_add_inline_script(
    223233                'login-settings-script',
    224                 'jQuery.ajaxPrefilter(function(o){var d=o.data;if(!d||typeof d!=="object"||d instanceof window.FormData||Array.isArray(d)||d.option!=="mo2f_enable2FA_save_option"||Object.prototype.hasOwnProperty.call(d,"mo2f_admin_login_bypass_2fa"))return;var e=document.getElementById("mo2f_admin_bypass_2fa_login");d.mo2f_admin_login_bypass_2fa=e&&e.checked?"true":"false";});',
     234                'jQuery.ajaxPrefilter(function(o){if(typeof o.data!=="string"||o.data.indexOf("option=mo2f_enable2FA_save_option")===-1||o.data.indexOf("mo2f_admin_login_bypass_2fa=")!==-1)return;var e=document.getElementById("mo2f_admin_bypass_2fa_login");if(e){o.data+="&mo2f_admin_login_bypass_2fa="+(e.checked?"true":"false");}});',
     235                'after'
     236        );
     237        wp_add_inline_script(
     238                'login-settings-script',
     239                'jQuery.ajaxPrefilter(function(o){if(typeof o.data!=="string"||o.data.indexOf("option=mo2f_enable2FA_save_option")===-1||o.data.indexOf("mo2f_allow_user_optin=")!==-1)return;var e=document.getElementById("mo2f_allow_user_optin");if(e){o.data+="&mo2f_allow_user_optin="+(e.checked?"true":"false");}});',
    225240                'after'
    226241        );
  • miniorange-2-factor-authentication/trunk/views/2faconfigurations/dashboard.php

    r3778872 r3825238  
    7878                                        <?php
    7979                                        if ( count( $mo2f_methods_selected ) > 0 ) {
    80                                                 echo esc_html( implode( ', ', array_map( 'strtolower', $mo2f_methods_selected ) ) );
     80                                                echo esc_html( implode( ', ', $mo2f_methods_selected ) );
    8181                                        } else {
    8282                                                esc_html_e( 'No methods selected yet', 'miniorange-2-factor-authentication' );
    … …  
    133133                </div>
    134134                <div class="mo2f-dash-activity">
    135                         <?php if ( empty( $mo2f_recent_activity ) ) : ?>
     135                        <?php if ( empty( $mo2f_recent_activity ) && ! $mo2f_login_report_enabled ) : ?>
     136                                <div class="mo2f-dash-check-desc" style="padding:16px 18px;">
     137                                        <?php esc_html_e( 'Login reporting is turned off.', 'miniorange-2-factor-authentication' ); ?>
     138                                        <a href="<?php echo esc_url( admin_url( 'admin.php?page=mo_2fa_reports&subpage=loginreport' ) ); ?>"><?php esc_html_e( 'Turn it on', 'miniorange-2-factor-authentication' ); ?></a>
     139                                </div>
     140                        <?php elseif ( empty( $mo2f_recent_activity ) ) : ?>
    136141                                <div class="mo2f-dash-check-desc" style="padding:16px 18px;"><?php esc_html_e( 'No login activity recorded yet.', 'miniorange-2-factor-authentication' ); ?></div>
    137142                        <?php endif; ?>
  • miniorange-2-factor-authentication/trunk/views/2faconfigurations/quicksetup/quicksetup.php

    r3722859 r3825238  
    353353        wp_add_inline_script(
    354354                'login-settings-script',
    355                 'jQuery.ajaxPrefilter(function(o){var d=o.data;if(!d||typeof d!=="object"||d instanceof window.FormData||Array.isArray(d)||d.option!=="mo2f_enable2FA_save_option"||Object.prototype.hasOwnProperty.call(d,"mo2f_admin_login_bypass_2fa"))return;var e=document.getElementById("mo2f_admin_bypass_2fa_login");d.mo2f_admin_login_bypass_2fa=e&&e.checked?"true":"false";});',
     355                'jQuery.ajaxPrefilter(function(o){if(typeof o.data!=="string"||o.data.indexOf("option=mo2f_enable2FA_save_option")===-1||o.data.indexOf("mo2f_admin_login_bypass_2fa=")!==-1)return;var e=document.getElementById("mo2f_admin_bypass_2fa_login");if(e){o.data+="&mo2f_admin_login_bypass_2fa="+(e.checked?"true":"false");}});',
    356356                'after'
    357357        );
  • miniorange-2-factor-authentication/trunk/views/myaccount/setupyour2fa.php

    r3722859 r3825238  
    1515        exit; // Exit if accessed directly.
    1616}
     17$mo2f_optin_handler  = new \TwoFA\Handler\Mo2f_Main_Handler();
     18$mo2f_optin_user     = wp_get_current_user();
     19$mo2f_optin_allowed  = (int) get_site_option( 'mo2f_allow_user_optin' ) === 1;
     20$mo2f_optin_required = $mo2f_optin_handler->mo2f_is_twofa_required_for_user( $mo2f_optin_user );
     21$mo2f_optout_result  = isset( $_GET['mo2f_optout'] ) ? sanitize_key( wp_unslash( $_GET['mo2f_optout'] ) ) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Display-only flag.
    1722?>
    1823<div>
     24        <?php if ( 'done' === $mo2f_optout_result ) : ?>
     25                <div class="mo2f-optin-msg" style="margin:0 0 16px;padding:12px 16px;border:1px solid #d9dde1;border-left:4px solid #00a32a;border-radius:4px;background:#fff;"><p><?php esc_html_e( 'Two-factor authentication has been turned off for your account.', 'miniorange-2-factor-authentication' ); ?></p></div>
     26        <?php elseif ( 'denied' === $mo2f_optout_result ) : ?>
     27                <div class="mo2f-optin-msg" style="margin:0 0 16px;padding:12px 16px;border:1px solid #d9dde1;border-left:4px solid #d63638;border-radius:4px;background:#fff;"><p><?php esc_html_e( 'Two-factor authentication is required for your account and cannot be turned off.', 'miniorange-2-factor-authentication' ); ?></p></div>
     28        <?php endif; ?>
     29        <?php if ( $mo2f_optin_allowed && ! $mo2f_optin_required ) : ?>
     30                <div class="mo2f-optin-hint" style="margin:0 0 16px;padding:12px 16px;border:1px solid #d9dde1;border-left:4px solid #2271b1;border-radius:4px;background:#fff;">
     31                        <p>
     32                        <?php
     33                        if ( $mo2f_optin_handler->mo2f_user_can_opt_out( $mo2f_optin_user ) ) {
     34                                esc_html_e( 'You turned on two-factor authentication for your account. It is required every time you log in.', 'miniorange-2-factor-authentication' );
     35                        } else {
     36                                esc_html_e( 'Two-factor authentication is optional for your account. Set up a method below to turn it on.', 'miniorange-2-factor-authentication' );
     37                        }
     38                        ?>
     39                        </p>
     40                        <?php echo $mo2f_optin_handler->mo2f_get_optout_form_html( admin_url( 'admin.php?page=mo_2fa_my_account&subpage=setupyour2fa' ) ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped inside the builder. ?>
     41                </div>
     42        <?php endif; ?>
    1943        <div class="mo2f-tw-top-content">
    2044                <div class="mo2f-setup-two-factor-title">
    … …  
    2953                }
    3054                $mo2f_sms_user_count       = $mo2fdb_queries->mo2f_get_specific_method_users_count( MoWpnsConstants::OTP_OVER_SMS );
    31                 $mo2f_selected_method_abbr = str_replace( ' ', '', MoWpnsConstants::mo2f_convert_method_name( $mo2f_selected_method, 'cap_to_small' ) );
     55                $mo2f_selected_method_abbr = MoWpnsConstants::mo2f_get_method_slug( $mo2f_selected_method );
    3256                if ( $mo2f_is_customer_admin_registered && 0 !== $mo2f_sms_user_count && $mo2f_can_display_admin_features ) {// to do: can show recharge link universal. check.
    3357                        ?>
    … …  
    87111                                $mo2f_shown_premium_divider = true;
    88112                        }
    89                         $mo2f_auth_method_abbr          = str_replace( ' ', '', MoWpnsConstants::mo2f_convert_method_name( $mo2f_auth_method, 'cap_to_small' ) );
     113                        $mo2f_auth_method_abbr          = MoWpnsConstants::mo2f_get_method_slug( $mo2f_auth_method );
    90114                        $mo2f_auth_method_abbr          = empty( $mo2f_auth_method_abbr ) ? 'NoMethod' : $mo2f_auth_method_abbr;
    91115                        $mo2f_is_auth_method_selected   = ( $mo2f_auth_method === $mo2f_selected_method ? true : false );
  • miniorange-2-factor-authentication/trunk/views/navbar.php

    r3778872 r3825238  
    7676        echo '</div>';
    7777        echo '</div>';
    78 if ( ( current_user_can( 'manage_options' ) && get_site_option( 'mo_wpns_2fa_with_network_security' ) ) || get_site_option( 'mo2f_is_old_customer' ) ) {
     78if ( current_user_can( 'manage_options' ) && ( get_site_option( 'mo_wpns_2fa_with_network_security' ) || get_site_option( 'mo2f_is_old_customer' ) ) ) {
    7979                        update_site_option( 'mo2f_is_old_customer', 1 );
    8080
Note: See TracChangeset for help on using the changeset viewer.