Show errors from the form_post POST request on the page #1697
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During a Supervisor login, the Supervisor uses a form_post web page to send its authcode to the CLI's localhost http listener via a Javascript
fetch
request. Although it is not common, this request could fail. For example, the authcode exchange could return an error. This PR changes the Javascript on that page to show the error response on the page.Here is an example of what an error will look like when rendered on the page:
I manually tested this in Chrome, Firefox, Edge (for Mac), and Safari. Note that Safari will never get these errors, because it will never send the post request due to a security limitation of Safari. Instead, Safari will always show the authcode for the user to copy/paste.
NOTE: Before releasing this, we should test it on a real Kubernetes cluster where the Supervisor has a real DNS entry. We can use the long-lived acceptance testing cluster for this. I'm curious if the browsers will behave differently in that case, since in my local testing it was using a domain which resolved to localhost (in my
/etc/hosts
file). I'm especially interested if the browser will cause CORS preflight requests for the Javascript POST request, which did not happen in my local testing.Release note: