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

This PR improves error handling around webauthn functions in the login.

(cherry picked from commit a82f5805b6)
This commit is contained in:
Max Peintner
2025-03-05 15:47:48 +01:00
committed by Livio Spring
parent 122b5f3e0e
commit 52bb9ca3a5
3 changed files with 68 additions and 50 deletions

View File

@@ -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");
}