mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-21 01:21:54 +08:00
feat: slightly nicer webauthn errors (closes #1137)
This commit is contained in:
parent
a88a231052
commit
475304dfc2
@ -20,6 +20,7 @@
|
||||
<option name="customHeaders">
|
||||
<set>
|
||||
<option value="X-Hangar-Verify" />
|
||||
<option value="Content-Security-Policy" />
|
||||
</set>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user