/** * Password step (login-password.ftl) for flows where username is already captured. * Adds conditional WebAuthn passkey authenticate section when enabled. */ import type { JSX } from "keycloakify/tools/JSX"; import { useState } from "react"; import { kcSanitize } from "keycloakify/lib/kcSanitize"; import { clsx } from "keycloakify/tools/clsx"; import { useIsPasswordRevealed } from "keycloakify/tools/useIsPasswordRevealed"; import { getKcClsx, type KcClsx } from "keycloakify/login/lib/kcClsx"; import type { PageProps } from "keycloakify/login/pages/PageProps"; import type { KcContext } from "../KcContext"; import type { I18n } from "../i18n"; import { useScript } from "keycloakify/login/pages/LoginPassword.useScript"; export default function LoginPassword(props: PageProps, I18n>) { const { kcContext, i18n, doUseDefaultCss, Template, classes } = props; const { kcClsx } = getKcClsx({ doUseDefaultCss, classes }); const { realm, url, messagesPerField, enableWebAuthnConditionalUI, authenticators } = kcContext; const { msg, msgStr } = i18n; const [isLoginButtonDisabled, setIsLoginButtonDisabled] = useState(false); const webAuthnButtonId = "authenticateWebAuthnButton"; useScript({ webAuthnButtonId, kcContext, i18n }); return ( ); } function PasswordWrapper(props: { kcClsx: KcClsx; i18n: I18n; passwordInputId: string; children: JSX.Element }) { const { kcClsx, i18n, passwordInputId, children } = props; const { msgStr } = i18n; const { isPasswordRevealed, toggleIsPasswordRevealed } = useIsPasswordRevealed({ passwordInputId }); return (
{children}
); }