remove server-side error messages for webauthn

since we are hard-coding a generic error message on the front-end, we
have no need to do anything on the back end. This is also nice as it
standardises the two flows to behave more like each other (rather than
previously where one would `flash` an error message and the other would
return CBOR for the js to decode).

Note that the register flow returns 400 while the auth flow returns 403.
The js for both just checks `response.ok` so will handle both. The JS
completely discards any body returned if the status isn't 200 now.
This commit is contained in:
Leo Hemsted
2021-09-14 14:31:45 +01:00
parent 2c55f4d0ce
commit a96bfdb16e
6 changed files with 41 additions and 75 deletions

View File

@@ -30,16 +30,7 @@
})
.then((response) => {
if (!response.ok) {
return response.arrayBuffer()
.then((cbor) => {
return Promise.resolve(window.CBOR.decode(cbor));
})
.catch(() => {
throw Error(response.statusText);
})
.then((text) => {
throw Error(text);
});
throw Error(response.statusText);
}
window.location.reload();
@@ -48,7 +39,6 @@
console.error(error);
// some browsers will show an error dialogue for some
// errors; to be safe we always display an error message on the page.
const message = error.message || error;
window.GOVUK.ErrorBanner.showBanner();
});
});