Skip to content

Commit

Permalink
Merge pull request #302 from Ecwid/PLUGINS-6837
Browse files Browse the repository at this point in the history
Plugins 6837
  • Loading branch information
meteor-ec authored Oct 16, 2024
2 parents 625481d + 7d2a81d commit 62b38a1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions includes/class-ecwid-admin-main-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,21 @@ public function _do_integrated_admin_page( $page = self::PAGE_HASH_DASHBOARD ) {
$result = $request->do_request( array( 'timeout' => 20 ) );
}//end if

$need_to_force_show_dashboard = false;

if ( ! empty( $result ) && $result['code'] == 403 ) {
Ecwid_Api_V3::save_token( '' );
if ( get_option( EcwidPlatform::OPTION_ECWID_CHECK_API_RETRY_AFTER, 0 ) == 0 ) {
Ecwid_Api_V3::set_api_status( Ecwid_Api_V3::API_STATUS_ERROR_TOKEN );
Ecwid_Api_V3::save_token( '' );
} else {
update_option( EcwidPlatform::OPTION_ECWID_CHECK_API_RETRY_AFTER, time() + 5 * MINUTE_IN_SECONDS );
$need_to_force_show_dashboard = true;
}
}

if ( empty( $result['code'] ) && empty( $result['data'] ) || $result['code'] == 500 ) {
require_once ECWID_PLUGIN_DIR . 'templates/admin-timeout.php';
} elseif ( $result['code'] != 200 ) {
} elseif ( $result['code'] != 200 && ! $need_to_force_show_dashboard ) {
if ( ecwid_test_oauth( true ) ) {
require_once ECWID_PLUGIN_DIR . 'templates/reconnect-sso.php';
} else {
Expand Down

0 comments on commit 62b38a1

Please sign in to comment.