| @@ -271,9 +271,10 @@ | ||
| 271 | 271 | |
| 272 | 272 | function metasyncLGLogin(user, pass) { |
| 273 | 273 | jQuery.post(ajaxurl, { |
| 274 | 274 | action: 'metasync_lglogin', |
| 275 | - username: user, password: pass | |
| 275 | + username: user, password: pass, | |
| 276 | + nonce: metaSync.lglogin_nonce || '' | |
| 276 | 277 | }, function (response) { |
| 277 | 278 | if (typeof response.token !== 'undefined') { |
| 278 | 279 | $('#linkgraph_token').val(response.token); |
| 279 | 280 | $('#linkgraph_customer_id').val(response.customer_id); |
| @@ -516,9 +517,14 @@ | ||
| 516 | 517 | } |
| 517 | 518 | |
| 518 | 519 | function startSearchAtlasPolling(nonceToken) { |
| 519 | 520 | var pollCount = 0; |
| 520 | - var maxPolls = 12; // Poll for 60 seconds (12 * 5 seconds) | |
| 521 | + // WP-558 (Option A): poll for 2 minutes (24 * 5s). Each poll also drives | |
| 522 | + // the outbound pull-based connect fallback server-side, which needs a | |
| 523 | + // slightly longer window than the legacy push-only 60s to ride out the | |
| 524 | + // human SSO-authorization delay. ~24 requests stays inside the CA | |
| 525 | + // endpoint's 120/hour per-domain budget. | |
| 526 | + var maxPolls = 24; // Poll for 120 seconds (24 * 5 seconds) | |
| 521 | 527 | var $progressContainer = $('.metasync-sa-connect-progress'); |
| 522 | 528 | var $progressFill = $('.metasync-sa-connect-progress-fill'); |
| 523 | 529 | var $progressText = $('.metasync-sa-connect-progress-text'); |
| 524 | 530 | var $button = $('#connect-searchatlas-btn'); |
| @@ -557,20 +563,20 @@ | ||
| 557 | 563 | |
| 558 | 564 | // ✅ Reset the authentication flow while keeping the timeout component |
| 559 | 565 | resetConnectButton(); |
| 560 | 566 | |
| 561 | - showConnectError('⏰ Authentication Timeout', | |
| 562 | - 'The authentication process timed out after 60 seconds. Please complete the authentication more quickly or check for network issues.', | |
| 567 | + showConnectError('⏰ Authentication Timeout', | |
| 568 | + 'The authentication process timed out after 2 minutes. Please complete the authentication more quickly or check for network issues.', | |
| 563 | 569 | [{ |
| 564 | 570 | text: '🔄 Try Again', |
| 565 | 571 | action: function () { |
| 566 | - handleSearchAtlasConnect(); | |
| 572 | + handleSearchAtlasConnect(); | |
| 567 | 573 | } |
| 568 | 574 | }, { |
| 569 | 575 | text: '💬 Contact Support', |
| 570 | - action: function () { | |
| 576 | + action: function () { | |
| 571 | 577 | var supportEmail = metaSync.support_email || '[email protected]'; |
| 572 | - window.open('mailto:' + supportEmail + '?subject=Connect Authentication Timeout (30s)', '_blank'); | |
| 578 | + window.open('mailto:' + supportEmail + '?subject=Connect Authentication Timeout (120s)', '_blank'); | |
| 573 | 579 | } |
| 574 | 580 | }] |
| 575 | 581 | ); |
| 576 | 582 | return; |
| @@ -773,9 +779,9 @@ | ||
| 773 | 779 | var timeElapsed = currentPoll * 5; |
| 774 | 780 | var timeRemaining = (maxPolls - currentPoll) * 5; |
| 775 | 781 | $progressTime.text(timeElapsed + 's elapsed, ' + timeRemaining + 's remaining'); |
| 776 | 782 | |
| 777 | - // Update progress text based on time elapsed (optimized for 60-second timeout) | |
| 783 | + // Update progress text based on time elapsed (optimized for 120-second timeout) | |
| 778 | 784 | var progressMessages = [ |
| 779 | 785 | 'Establishing connection and opening authentication window...', |
| 780 | 786 | 'Please complete authentication in the popup window...', |
| 781 | 787 | 'Almost done! Finalizing your authentication...' |
| @@ -915,9 +921,18 @@ | ||
| 915 | 921 | }, { |
| 916 | 922 | text: '📚 Learn More About Registration', |
| 917 | 923 | action: function () { |
| 918 | 924 | var docDomain = metaSync.documentation_domain || 'https://searchatlas.com'; |
| 919 | - window.open(docDomain, '_blank'); | |
| 925 | + try { | |
| 926 | + var parsedDoc = new URL(docDomain); | |
| 927 | + if (parsedDoc.protocol === 'https:' || parsedDoc.protocol === 'http:') { | |
| 928 | + var a = document.createElement('a'); | |
| 929 | + a.href = parsedDoc.href; | |
| 930 | + a.target = '_blank'; | |
| 931 | + a.rel = 'noopener'; | |
| 932 | + a.click(); | |
| 933 | + } | |
| 934 | + } catch (e) { /* invalid URL */ } | |
| 920 | 935 | } |
| 921 | 936 | }, { |
| 922 | 937 | text: '🔄 Try Authentication Again', |
| 923 | 938 | action: function () { |
| @@ -999,9 +1014,9 @@ | ||
| 999 | 1014 | 'Check if firewall is blocking the request' |
| 1000 | 1015 | ]; |
| 1001 | 1016 | } else if (context === 'timeout') { |
| 1002 | 1017 | recoverySuggestions = [ |
| 1003 | - 'Complete authentication within 60 seconds', | |
| 1018 | + 'Complete authentication within 2 minutes', | |
| 1004 | 1019 | 'Check if the popup window needs attention', |
| 1005 | 1020 | 'Ensure you have your ' + getPluginName() + ' login ready', |
| 1006 | 1021 | 'Try the authentication process again', |
| 1007 | 1022 | 'Contact support if timeouts persist' |
| @@ -2174,9 +2189,10 @@ | ||
| 2174 | 2189 | url: ajaxurl, |
| 2175 | 2190 | type: 'GET', |
| 2176 | 2191 | data: { |
| 2177 | 2192 | action: 'metasync_clear_otto_cache', |
| 2178 | - clear_otto_cache: 1 | |
| 2193 | + clear_otto_cache: 1, | |
| 2194 | + nonce: metaSync.clear_otto_cache_nonce || '' | |
| 2179 | 2195 | }, |
| 2180 | 2196 | success: function (response) { |
| 2181 | 2197 | const now = new Date(); |
| 2182 | 2198 | $('#clear_otto_caches').text('Cache Cleared ' + now.toLocaleTimeString()); |