2024-06-09 08:27:07 +02:00
|
|
|
import { getKcClsx } from "keycloakify/login/lib/kcClsx";
|
2024-06-05 21:13:58 +02:00
|
|
|
import type { PageProps } from "keycloakify/login/pages/PageProps";
|
|
|
|
import type { KcContext } from "../KcContext";
|
2024-06-09 04:43:18 +02:00
|
|
|
import { useI18n } from "../i18n";
|
2024-05-11 19:18:52 +02:00
|
|
|
|
2024-06-09 04:43:18 +02:00
|
|
|
export default function WebauthnError(props: PageProps<Extract<KcContext, { pageId: "webauthn-error.ftl" }>>) {
|
|
|
|
const { kcContext, doUseDefaultCss, Template, classes } = props;
|
2024-05-11 19:18:52 +02:00
|
|
|
|
|
|
|
const { url, isAppInitiatedAction } = kcContext;
|
|
|
|
|
2024-06-09 04:43:18 +02:00
|
|
|
const { msg, msgStr } = useI18n({ kcContext });
|
2024-05-11 19:18:52 +02:00
|
|
|
|
2024-06-09 08:27:07 +02:00
|
|
|
const { kcClsx } = getKcClsx({
|
2024-05-11 19:18:52 +02:00
|
|
|
doUseDefaultCss,
|
|
|
|
classes
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
2024-06-09 08:27:07 +02:00
|
|
|
<Template kcContext={kcContext} doUseDefaultCss={doUseDefaultCss} classes={classes} displayMessage headerNode={msg("webauthn-error-title")}>
|
|
|
|
<form id="kc-error-credential-form" className={kcClsx("kcFormClass")} action={url.loginAction} method="post">
|
2024-05-11 19:18:52 +02:00
|
|
|
<input type="hidden" id="executionValue" name="authenticationExecution" />
|
|
|
|
<input type="hidden" id="isSetRetry" name="isSetRetry" />
|
|
|
|
</form>
|
|
|
|
<input
|
|
|
|
tabIndex={4}
|
|
|
|
onClick={() => {
|
|
|
|
// @ts-expect-error: Trusted Keycloak's code
|
|
|
|
document.getElementById("isSetRetry").value = "retry";
|
|
|
|
// @ts-expect-error: Trusted Keycloak's code
|
|
|
|
document.getElementById("executionValue").value = "${execution}";
|
|
|
|
// @ts-expect-error: Trusted Keycloak's code
|
|
|
|
document.getElementById("kc-error-credential-form").submit();
|
|
|
|
}}
|
|
|
|
type="button"
|
2024-06-09 08:27:07 +02:00
|
|
|
className={kcClsx("kcButtonClass", "kcButtonPrimaryClass", "kcButtonBlockClass", "kcButtonLargeClass")}
|
2024-05-11 19:18:52 +02:00
|
|
|
name="try-again"
|
|
|
|
id="kc-try-again"
|
|
|
|
value={msgStr("doTryAgain")}
|
|
|
|
/>
|
|
|
|
{isAppInitiatedAction && (
|
2024-06-09 08:27:07 +02:00
|
|
|
<form action={url.loginAction} className={kcClsx("kcFormClass")} id="kc-webauthn-settings-form" method="post">
|
2024-05-11 19:18:52 +02:00
|
|
|
<button
|
|
|
|
type="submit"
|
2024-06-09 08:27:07 +02:00
|
|
|
className={kcClsx("kcButtonClass", "kcButtonDefaultClass", "kcButtonBlockClass", "kcButtonLargeClass")}
|
2024-05-11 19:18:52 +02:00
|
|
|
id="cancelWebAuthnAIA"
|
|
|
|
name="cancel-aia"
|
|
|
|
value="true"
|
|
|
|
>
|
|
|
|
{msgStr("doCancel")}
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
)}
|
|
|
|
</Template>
|
|
|
|
);
|
|
|
|
}
|