fix: client secret getting corrupted on save
Two bugs fixed: 1. sanitize_text_field() was stripping special characters from Azure AD client secrets (e.g. %XX sequences, angle brackets). Replaced with trim() to preserve the raw secret before encryption. 2. All settings tabs shared one option group (wbc_settings), so saving from any tab would trigger sanitize callbacks for ALL settings. This caused checkboxes on other tabs to reset to 'no' and could interfere with the client secret. Split into per-tab groups: wbc_connection, wbc_sync, wbc_orders. Also clears OAuth token cache when client secret is changed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,7 @@ $tabs = array(
|
||||
<?php if ( $current_tab === 'connection' ) : ?>
|
||||
<!-- Connection Settings -->
|
||||
<form method="post" action="options.php" class="wbc-settings-form">
|
||||
<?php settings_fields( 'wbc_settings' ); ?>
|
||||
<?php settings_fields( 'wbc_connection' ); ?>
|
||||
|
||||
<div class="wbc-card">
|
||||
<h2><?php esc_html_e( 'Microsoft Azure AD Credentials', 'woo-business-central' ); ?></h2>
|
||||
@@ -141,7 +141,7 @@ $tabs = array(
|
||||
<?php elseif ( $current_tab === 'sync' ) : ?>
|
||||
<!-- Sync Settings -->
|
||||
<form method="post" action="options.php" class="wbc-settings-form">
|
||||
<?php settings_fields( 'wbc_settings' ); ?>
|
||||
<?php settings_fields( 'wbc_sync' ); ?>
|
||||
|
||||
<div class="wbc-card">
|
||||
<h2><?php esc_html_e( 'Product Sync Settings', 'woo-business-central' ); ?></h2>
|
||||
@@ -218,7 +218,7 @@ $tabs = array(
|
||||
<?php elseif ( $current_tab === 'orders' ) : ?>
|
||||
<!-- Order Settings -->
|
||||
<form method="post" action="options.php" class="wbc-settings-form">
|
||||
<?php settings_fields( 'wbc_settings' ); ?>
|
||||
<?php settings_fields( 'wbc_orders' ); ?>
|
||||
|
||||
<div class="wbc-card">
|
||||
<h2><?php esc_html_e( 'Order Sync Settings', 'woo-business-central' ); ?></h2>
|
||||
|
||||
Reference in New Issue
Block a user