403)); } if (isset($_POST['dwarpal_2fa_settings']) && isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'dwarpal_2fa_settings')) { $dwarpal_old_value = get_option('dwarpal_2fa_enabled', false); $dwarpal_new_value = isset($_POST['dwarpal_2fa_enabled']) ? 1 : 0; $dwarpal_result = update_option('dwarpal_2fa_enabled', $dwarpal_new_value); // Log the change if (class_exists('Dwarpal_Security')) { $dwarpal_security = new Dwarpal_Security(); $dwarpal_status = $dwarpal_new_value ? 'enabled' : 'disabled'; $dwarpal_security->log_event('settings_changed', sprintf('Two-Factor Authentication %s by user: %s', $dwarpal_status, wp_get_current_user()->user_login)); } if ($dwarpal_result !== false) { echo '
' . esc_html__('Settings saved. Two-Factor Authentication is now ', 'dwarpal') . ($dwarpal_new_value ? esc_html__('enabled', 'dwarpal') : esc_html__('disabled', 'dwarpal')) . '.
' . esc_html__('Error: Settings could not be saved.', 'dwarpal') . '
' . esc_html__('Security check failed. Please try again.', 'dwarpal') . '