"'.$post_first_choice.'"'); } wwa_update_option('first_choice', $post_first_choice); $post_user_verification = sanitize_text_field(wp_unslash($_POST['user_verification'] ?? 'false')); if(!in_array($post_user_verification, array('true', 'false'), true)){ $post_user_verification = 'false'; } if($post_user_verification !== wwa_get_option('user_verification')){ wwa_add_log($res_id, 'network user_verification: "'.wwa_get_option('user_verification').'"->"'.$post_user_verification.'"'); } wwa_update_option('user_verification', $post_user_verification); $post_usernameless_login = sanitize_text_field(wp_unslash($_POST['usernameless_login'] ?? 'false')); if(!in_array($post_usernameless_login, array('true', 'false'), true)){ $post_usernameless_login = 'false'; } if($post_usernameless_login !== wwa_get_option('usernameless_login')){ wwa_add_log($res_id, 'network usernameless_login: "'.wwa_get_option('usernameless_login').'"->"'.$post_usernameless_login.'"'); } wwa_update_option('usernameless_login', $post_usernameless_login); $post_allow_type = sanitize_text_field(wp_unslash($_POST['allow_authenticator_type'] ?? 'none')); if(!in_array($post_allow_type, array('none', 'platform', 'cross-platform'), true)){ $post_allow_type = 'none'; } if($post_allow_type !== wwa_get_option('allow_authenticator_type')){ wwa_add_log($res_id, 'network allow_authenticator_type: "'.wwa_get_option('allow_authenticator_type').'"->"'.$post_allow_type.'"'); } wwa_update_option('allow_authenticator_type', $post_allow_type); $post_show_type = sanitize_text_field(wp_unslash($_POST['show_authenticator_type'] ?? 'false')); if(!in_array($post_show_type, array('true', 'false'), true)){ $post_show_type = 'false'; } if($post_show_type !== wwa_get_option('show_authenticator_type')){ wwa_add_log($res_id, 'network show_authenticator_type: "'.wwa_get_option('show_authenticator_type').'"->"'.$post_show_type.'"'); } wwa_update_option('show_authenticator_type', $post_show_type); $raw_ror = wp_unslash($_POST['ror_origins'] ?? ''); $ror_lines = explode("\n", $raw_ror); $sanitized_ror = array(); foreach($ror_lines as $line){ $line = trim($line); if($line === ''){ continue; } $parsed = wp_parse_url($line); if(isset($parsed['scheme']) && isset($parsed['host'])){ $origin = $parsed['scheme'] . '://' . $parsed['host']; if(isset($parsed['port'])){ $origin .= ':' . $parsed['port']; } $sanitized_ror[] = $origin; } } $post_ror_origins = implode("\n", $sanitized_ror); if($post_ror_origins !== wwa_get_option('ror_origins')){ wwa_add_log($res_id, 'network ror_origins: "'.str_replace("\n", ', ', wwa_get_option('ror_origins')).'"->"'.str_replace("\n", ', ', $post_ror_origins).'"'); } wwa_update_option('ror_origins', $post_ror_origins); wp_safe_redirect(add_query_arg('updated', 'true', network_admin_url('settings.php?page=wwa_network_admin'))); exit; } // Display network settings page function wwa_display_network_settings(){ if(!current_user_can('manage_network_options')){ wp_die(esc_html__('You do not have sufficient permissions to access this page.')); } wp_enqueue_script('wwa_admin', plugins_url('js/admin.js', __FILE__), array(), get_option('wwa_version')['version']); wp_localize_script('wwa_admin', 'php_vars', array( 'ajax_url' => admin_url('admin-ajax.php'), '_ajax_nonce' => wp_create_nonce('wwa_admin_ajax'), 'i18n_1' => __('User verification is disabled by default because some mobile devices do not support it (especially on Android devices). But we recommend you to enable it if possible to further secure your login.', 'wp-webauthn'), 'i18n_2' => __('Log count: ', 'wp-webauthn'), 'i18n_3' => __('Loading failed, maybe try refreshing?', 'wp-webauthn') )); wp_enqueue_style('wwa_admin', plugins_url('css/admin.css', __FILE__)); $wwa_not_allowed = false; if(!function_exists('mb_substr') || !function_exists('gmp_intval') || !function_exists('sodium_crypto_sign_detached') || !wwa_check_ssl() && (wp_parse_url(site_url(), PHP_URL_HOST) !== 'localhost' && wp_parse_url(site_url(), PHP_URL_HOST) !== '127.0.0.1')){ $wwa_not_allowed = true; } ?>