import React, { useState } from "react"; import { clsx } from "../tools/clsx"; import { useConstCallback } from "../tools/useConstCallback"; import type { FormEventHandler } from "react"; import type { KcContextBase } from "../getKcContext"; import type { PageProps } from "../KcProps"; import type { I18nBase } from "../i18n"; export default function LoginPassword(props: PageProps) { const { kcContext, i18n, doFetchDefaultThemeResources = true, Template, ...kcProps } = props; const { realm, url, login } = kcContext; const { msg, msgStr } = i18n; const [isLoginButtonDisabled, setIsLoginButtonDisabled] = useState(false); const onSubmit = useConstCallback>(e => { e.preventDefault(); setIsLoginButtonDisabled(true); const formElement = e.target as HTMLFormElement; formElement.submit(); }); return (