site-kit-wp
site-kit-wp copied to clipboard
Update format of nonce error with help
Feature Description
In #5482 we introduced a "get help" link in our invalid nonce error which we later flagged as potentially benefiting from a modified format https://github.com/google/site-kit-wp/issues/5482#issuecomment-1212368075.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The format of the custom invalid nonce error displayed for invalid proxy nonces should be adjusted as follows (actual URLs have been omitted as these should not change)
The link you followed has expired.
Please try again. Retry didn’t work? Get help
Implementation Brief
- In
includes/Core/Authentication/Authentication.php
:- Locate the
invalid_nonce_error
method. Inside the method:- In the
$html
variable concatenation assignment where the linksPlease try again
andGet help
are displayed, add the text in between to match the ACs. - Ensure that the text is translatable including any concatenation is translatable.
- In the
- Locate the
Test Coverage
- In
tests/phpunit/integration/Core/Authentication/AuthenticationTest.php
:- Update both
test_handle_proxy_permissions
andtest_invalid_nonce_error_sitekit_action
test cases to include the updated error message format.
- Update both
QA Brief
- Go to the Site Kit splash screen in the not connected state.
- Add the following snippet of code to your
functions.php
file:add_filter( 'nonce_life', 'wp_nonce_life_filter' ); function wp_nonce_life_filter(){ return 1; }
- Try to connect Site Kit and you should see the nonce error.
- Verify that the nonce error format matches the ACs.
Changelog entry
- N/A
@felixarntz should we update the usage to be consistent with other cases as in https://github.com/google/site-kit-wp/issues/5482#issuecomment-1215228668?
@aaemnnosttv Yeah I think that would make sense. We could simply add the Retry didn't work?
bit before the Get help
link.
@nfmohit I should have highlighted this in the ACs but this is a good example of where the text shouldn't be duplicated in the IB as the quote in the ACs is a stylized quote but the one in the IB is not. This doesn't really need very much for an IB at all to be honest, simply pointing out where the changes should be made along with the estimate should be sufficient as the AC doesn't really leave room for different approaches.
This is basically good to go, I just tweaked the one line.
IB ✅
Understood. Absolutely agreed. Thank you for the explanation, @aaemnnosttv!
QA Update ✅
- Verified on dev.
- Verified by following steps mentioned under QAB.
- Nonce error showing as per AC.
- On clicking 'get help' link user navigates to https://sitekit.withgoogle.com/documentation/troubleshooting/setup/#link-expired
- On clicking 'Please try again' link user gets navigates back to dashboard.
https://user-images.githubusercontent.com/94359491/196114235-efd0c7b1-66b9-4ffb-872e-b8c5fd5ffcb1.mp4