Files
keycloak_theme/src/login/pages/IdpReviewUserProfile.tsx

63 lines
2.6 KiB
TypeScript
Raw Normal View History

2023-03-18 06:14:05 +01:00
import { useState } from "react";
import type { LazyOrNot } from "keycloakify/tools/LazyOrNot";
2024-06-09 08:27:07 +02:00
import { getKcClsx } from "keycloakify/login/lib/kcClsx";
import type { PageProps } from "keycloakify/login/pages/PageProps";
2024-06-11 20:40:00 +02:00
import type { UserProfileFormFieldsProps } from "keycloakify/login/UserProfileFormFieldsProps";
import type { KcContext } from "../KcContext";
import type { I18n } from "../i18n";
2022-09-09 12:55:57 +02:00
type IdpReviewUserProfileProps = PageProps<Extract<KcContext, { pageId: "idp-review-user-profile.ftl" }>, I18n> & {
2024-06-11 20:40:00 +02:00
UserProfileFormFields: LazyOrNot<(props: UserProfileFormFieldsProps<KcContext, I18n>) => JSX.Element>;
doMakeUserConfirmPassword: boolean;
};
export default function IdpReviewUserProfile(props: IdpReviewUserProfileProps) {
const { kcContext, i18n, doUseDefaultCss, Template, classes, UserProfileFormFields, doMakeUserConfirmPassword } = props;
2023-03-18 06:14:05 +01:00
2024-06-09 08:27:07 +02:00
const { kcClsx } = getKcClsx({
2023-03-21 05:27:31 +01:00
doUseDefaultCss,
2023-03-18 06:14:05 +01:00
classes
});
const { msg, msgStr } = i18n;
const { url, messagesPerField } = kcContext;
const [isFomSubmittable, setIsFomSubmittable] = useState(false);
return (
<Template
2024-06-09 08:27:07 +02:00
kcContext={kcContext}
i18n={i18n}
2024-06-09 08:27:07 +02:00
doUseDefaultCss={doUseDefaultCss}
classes={classes}
displayMessage={messagesPerField.exists("global")}
displayRequiredFields
headerNode={msg("loginIdpReviewProfileTitle")}
>
2024-06-09 08:27:07 +02:00
<form id="kc-idp-review-profile-form" className={kcClsx("kcFormClass")} action={url.loginAction} method="post">
<UserProfileFormFields
kcContext={kcContext}
i18n={i18n}
onIsFormSubmittableValueChange={setIsFomSubmittable}
kcClsx={kcClsx}
doMakeUserConfirmPassword={doMakeUserConfirmPassword}
/>
2024-06-09 08:27:07 +02:00
<div className={kcClsx("kcFormGroupClass")}>
<div id="kc-form-options" className={kcClsx("kcFormOptionsClass")}>
<div className={kcClsx("kcFormOptionsWrapperClass")} />
</div>
2024-06-09 08:27:07 +02:00
<div id="kc-form-buttons" className={kcClsx("kcFormButtonsClass")}>
2023-03-21 02:36:13 +01:00
<input
2024-06-09 08:27:07 +02:00
className={kcClsx("kcButtonClass", "kcButtonPrimaryClass", "kcButtonBlockClass", "kcButtonLargeClass")}
2023-03-21 02:36:13 +01:00
type="submit"
value={msgStr("doSubmit")}
disabled={!isFomSubmittable}
/>
</div>
</div>
</form>
</Template>
);
}