fix(login): improve webauthn error handling (#9474)

This PR improves error handling around webauthn functions in the login.
This commit is contained in:
Max Peintner
2025-03-05 14:47:48 +00:00
committed by GitHub
parent b0fa974419
commit a82f5805b6
3 changed files with 68 additions and 50 deletions
@@ -15,7 +15,17 @@ function checkWebauthnSupported(button, func) {
function webauthnError(error) {
let err = document.getElementById("wa-error");
err.getElementsByClassName("cause")[0].innerText = error.message;
let causeElement = err.getElementsByClassName("cause")[0];
if (error.message) {
causeElement.innerText = error.message;
} else if (error.value) {
causeElement.innerText = error.value;
} else {
console.error("Unknown error:", error);
causeElement.innerText = "An unknown error occurred.";
}
err.classList.remove("hidden");
}