mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-12-15 06:41:46 +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">
|
<option name="customHeaders">
|
||||||
<set>
|
<set>
|
||||||
<option value="X-Hangar-Verify" />
|
<option value="X-Hangar-Verify" />
|
||||||
|
<option value="Content-Security-Policy" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
|
@ -70,7 +70,11 @@ async function loginWebAuthN() {
|
|||||||
});
|
});
|
||||||
await finish(response);
|
await finish(response);
|
||||||
} catch (e) {
|
} 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;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,8 @@ async function addAuthenticator() {
|
|||||||
savedRequest.value = e.config;
|
savedRequest.value = e.config;
|
||||||
} else if (e.response?.data?.detail === "error.privileged") {
|
} else if (e.response?.data?.detail === "error.privileged") {
|
||||||
await router.push(useAuth.loginUrl(route.path) + "&privileged=true");
|
await router.push(useAuth.loginUrl(route.path) + "&privileged=true");
|
||||||
|
} else if (e?.toString()?.startsWith("NotAllowedError")) {
|
||||||
|
notification.error("Security Key Authentication failed!");
|
||||||
} else {
|
} else {
|
||||||
notification.fromError(i18n, e);
|
notification.fromError(i18n, e);
|
||||||
}
|
}
|
||||||
@ -73,6 +75,8 @@ async function unregisterAuthenticator(authenticator: AuthSettings["authenticato
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.response?.data?.detail === "error.privileged") {
|
if (e.response?.data?.detail === "error.privileged") {
|
||||||
await router.push(useAuth.loginUrl(route.path) + "&privileged=true");
|
await router.push(useAuth.loginUrl(route.path) + "&privileged=true");
|
||||||
|
} else if (e?.toString()?.startsWith("NotAllowedError")) {
|
||||||
|
notification.error("Security Key Authentication failed!");
|
||||||
} else {
|
} else {
|
||||||
notification.fromError(i18n, e);
|
notification.fromError(i18n, e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user