Revert "API ISsues fixes pluigna dn app, plugin v udapte 1.4.0"
This reverts commit a361dea528.
This commit is contained in:
@@ -363,24 +363,17 @@ function igny8_get_connection_state() {
|
||||
$integration_id = get_option('igny8_integration_id');
|
||||
$last_structure_sync = get_option('igny8_last_structure_sync');
|
||||
|
||||
// SECURITY: Must have API key to show ANY connection state
|
||||
if (empty($api_key)) {
|
||||
igny8_log_connection_state('not_connected', 'No API key found');
|
||||
return 'not_connected';
|
||||
}
|
||||
|
||||
// SECURITY: Only show 'connected' if API key is validated
|
||||
// Check if we have a recent successful API health check (within last hour)
|
||||
$last_health_check = get_option('igny8_last_api_health_check', 0);
|
||||
$one_hour_ago = time() - 3600;
|
||||
|
||||
if (!empty($api_key) && !empty($integration_id) && !empty($last_structure_sync) && $last_health_check > $one_hour_ago) {
|
||||
igny8_log_connection_state('connected', 'Fully connected and synced with validated API key');
|
||||
if (!empty($api_key) && !empty($integration_id) && !empty($last_structure_sync)) {
|
||||
igny8_log_connection_state('connected', 'Fully connected and synced');
|
||||
return 'connected';
|
||||
}
|
||||
|
||||
// If we have API key but no recent validation, show as 'configured' not 'connected'
|
||||
igny8_log_connection_state('configured', 'API key set, validation pending');
|
||||
igny8_log_connection_state('configured', 'API key set, pending structure sync');
|
||||
return 'configured';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user