feat: slightly nicer webauthn errors (closes #1137)

This commit is contained in:
MiniDigger | Martin 2023-04-19 21:16:46 +02:00
parent a88a231052
commit 475304dfc2
3 changed files with 10 additions and 1 deletions

View File

@ -20,6 +20,7 @@
<option name="customHeaders">
<set>
<option value="X-Hangar-Verify" />
<option value="Content-Security-Policy" />
</set>
</option>
</inspection_tool>

View File

@ -70,7 +70,11 @@ async function loginWebAuthN() {
});
await finish(response);
} catch (e) {
notification.fromError(i18n, e);
if (e?.toString()?.startsWith("NotAllowedError")) {
notification.error("Security Key Authentication failed!");
} else {
notification.fromError(i18n, e);
}
}
loading.value = false;
}

View File

@ -58,6 +58,8 @@ async function addAuthenticator() {
savedRequest.value = e.config;
} else if (e.response?.data?.detail === "error.privileged") {
await router.push(useAuth.loginUrl(route.path) + "&privileged=true");
} else if (e?.toString()?.startsWith("NotAllowedError")) {
notification.error("Security Key Authentication failed!");
} else {
notification.fromError(i18n, e);
}
@ -73,6 +75,8 @@ async function unregisterAuthenticator(authenticator: AuthSettings["authenticato
} catch (e) {
if (e.response?.data?.detail === "error.privileged") {
await router.push(useAuth.loginUrl(route.path) + "&privileged=true");
} else if (e?.toString()?.startsWith("NotAllowedError")) {
notification.error("Security Key Authentication failed!");
} else {
notification.fromError(i18n, e);
}