2023-03-18 06:14:05 +01:00
|
|
|
import { useState } from "react";
|
2024-05-11 00:11:50 +02:00
|
|
|
import type { LazyOrNot } from "keycloakify/tools/LazyOrNot";
|
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";
|
2024-05-11 00:11:50 +02:00
|
|
|
import type { UserProfileFormFieldsProps } from "keycloakify/login/UserProfileFormFields";
|
2024-06-05 21:13:58 +02:00
|
|
|
import type { KcContext } from "../KcContext";
|
2024-06-09 04:43:18 +02:00
|
|
|
import { useI18n } from "../i18n";
|
2022-09-09 12:55:57 +02:00
|
|
|
|
2024-06-09 04:43:18 +02:00
|
|
|
type IdpReviewUserProfileProps = PageProps<Extract<KcContext, { pageId: "idp-review-user-profile.ftl" }>> & {
|
2024-05-11 00:11:50 +02:00
|
|
|
UserProfileFormFields: LazyOrNot<(props: UserProfileFormFieldsProps) => JSX.Element>;
|
2024-06-09 09:34:39 +02:00
|
|
|
doMakeUserConfirmPassword: boolean;
|
2024-05-11 00:11:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function IdpReviewUserProfile(props: IdpReviewUserProfileProps) {
|
2024-06-09 09:34:39 +02:00
|
|
|
const { kcContext, 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
|
|
|
|
});
|
2022-10-13 11:58:31 +02:00
|
|
|
|
2024-06-09 04:43:18 +02:00
|
|
|
const { msg, msgStr } = useI18n({ kcContext });
|
2022-10-13 11:58:31 +02:00
|
|
|
|
2024-05-11 00:11:50 +02:00
|
|
|
const { url, messagesPerField } = kcContext;
|
2022-10-13 11:58:31 +02:00
|
|
|
|
|
|
|
const [isFomSubmittable, setIsFomSubmittable] = useState(false);
|
|
|
|
|
|
|
|
return (
|
2024-05-11 00:11:50 +02:00
|
|
|
<Template
|
2024-06-09 08:27:07 +02:00
|
|
|
kcContext={kcContext}
|
|
|
|
doUseDefaultCss={doUseDefaultCss}
|
|
|
|
classes={classes}
|
2024-05-11 00:11:50 +02:00
|
|
|
displayMessage={messagesPerField.exists("global")}
|
2024-05-14 02:37:55 +02:00
|
|
|
displayRequiredFields
|
2024-05-11 00:11:50 +02:00
|
|
|
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">
|
2024-06-09 09:34:39 +02:00
|
|
|
<UserProfileFormFields
|
|
|
|
kcContext={kcContext}
|
|
|
|
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")} />
|
2022-10-13 11:58:31 +02:00
|
|
|
</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>
|
2022-10-13 11:58:31 +02:00
|
|
|
);
|
2023-02-25 18:11:23 +01:00
|
|
|
}
|