Feat idp-review-user-profile.ftl #164
This commit is contained in:
@ -28,7 +28,8 @@ export const pageIds = [
|
|||||||
"login-page-expired.ftl",
|
"login-page-expired.ftl",
|
||||||
"login-config-totp.ftl",
|
"login-config-totp.ftl",
|
||||||
"logout-confirm.ftl",
|
"logout-confirm.ftl",
|
||||||
"update-user-profile.ftl"
|
"update-user-profile.ftl",
|
||||||
|
"idp-review-user-profile.ftl"
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type BuildOptionsLike = BuildOptionsLike.Standalone | BuildOptionsLike.ExternalAssets;
|
export type BuildOptionsLike = BuildOptionsLike.Standalone | BuildOptionsLike.ExternalAssets;
|
||||||
|
46
src/lib/components/IdpReviewUserProfile.tsx
Normal file
46
src/lib/components/IdpReviewUserProfile.tsx
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import React, { useState, memo } from "react";
|
||||||
|
import Template from "./Template";
|
||||||
|
import type { KcProps } from "./KcProps";
|
||||||
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
||||||
|
import { useCssAndCx } from "../tools/useCssAndCx";
|
||||||
|
import type { I18n } from "../i18n";
|
||||||
|
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
||||||
|
|
||||||
|
const IdpReviewUserProfile = memo(({ kcContext, i18n, ...props }: { kcContext: KcContextBase.IdpReviewUserProfile; i18n: I18n } & KcProps) => {
|
||||||
|
const { cx } = useCssAndCx();
|
||||||
|
|
||||||
|
const { msg, msgStr } = i18n;
|
||||||
|
|
||||||
|
const { url } = kcContext;
|
||||||
|
|
||||||
|
const [isFomSubmittable, setIsFomSubmittable] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Template
|
||||||
|
{...{ kcContext, i18n, ...props }}
|
||||||
|
doFetchDefaultThemeResources={true}
|
||||||
|
headerNode={msg("loginIdpReviewProfileTitle")}
|
||||||
|
formNode={
|
||||||
|
<form id="kc-idp-review-profile-form" className={cx(props.kcFormClass)} action={url.loginAction} method="post">
|
||||||
|
<UserProfileFormFields kcContext={kcContext} onIsFormSubmittableValueChange={setIsFomSubmittable} i18n={i18n} {...props} />
|
||||||
|
|
||||||
|
<div className={cx(props.kcFormGroupClass)}>
|
||||||
|
<div id="kc-form-options" className={cx(props.kcFormOptionsClass)}>
|
||||||
|
<div className={cx(props.kcFormOptionsWrapperClass)} />
|
||||||
|
</div>
|
||||||
|
<div id="kc-form-buttons" className={cx(props.kcFormButtonsClass)}>
|
||||||
|
<input
|
||||||
|
className={cx(props.kcButtonClass, props.kcButtonPrimaryClass, props.kcButtonBlockClass, props.kcButtonLargeClass)}
|
||||||
|
type="submit"
|
||||||
|
value={msgStr("doSubmit")}
|
||||||
|
disabled={!isFomSubmittable}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default IdpReviewUserProfile;
|
@ -21,6 +21,7 @@ const LoginIdpLinkEmail = lazy(() => import("./LoginIdpLinkEmail"));
|
|||||||
const LoginConfigTotp = lazy(() => import("./LoginConfigTotp"));
|
const LoginConfigTotp = lazy(() => import("./LoginConfigTotp"));
|
||||||
const LogoutConfirm = lazy(() => import("./LogoutConfirm"));
|
const LogoutConfirm = lazy(() => import("./LogoutConfirm"));
|
||||||
const UpdateUserProfile = lazy(() => import("./UpdateUserProfile"));
|
const UpdateUserProfile = lazy(() => import("./UpdateUserProfile"));
|
||||||
|
const IdpReviewUserProfile = lazy(() => import("./IdpReviewUserProfile"));
|
||||||
|
|
||||||
const KcApp = memo(({ kcContext, i18n: userProvidedI18n, ...kcProps }: { kcContext: KcContextBase; i18n?: I18n } & KcProps) => {
|
const KcApp = memo(({ kcContext, i18n: userProvidedI18n, ...kcProps }: { kcContext: KcContextBase; i18n?: I18n } & KcProps) => {
|
||||||
const i18n = (function useClosure() {
|
const i18n = (function useClosure() {
|
||||||
@ -77,6 +78,8 @@ const KcApp = memo(({ kcContext, i18n: userProvidedI18n, ...kcProps }: { kcConte
|
|||||||
return <LogoutConfirm {...{ kcContext, ...props }} />;
|
return <LogoutConfirm {...{ kcContext, ...props }} />;
|
||||||
case "update-user-profile.ftl":
|
case "update-user-profile.ftl":
|
||||||
return <UpdateUserProfile {...{ kcContext, ...props }} />;
|
return <UpdateUserProfile {...{ kcContext, ...props }} />;
|
||||||
|
case "idp-review-user-profile.ftl":
|
||||||
|
return <IdpReviewUserProfile {...{ kcContext, ...props }} />;
|
||||||
}
|
}
|
||||||
})()}
|
})()}
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
@ -26,7 +26,8 @@ export type KcContextBase =
|
|||||||
| KcContextBase.LoginPageExpired
|
| KcContextBase.LoginPageExpired
|
||||||
| KcContextBase.LoginConfigTotp
|
| KcContextBase.LoginConfigTotp
|
||||||
| KcContextBase.LogoutConfirm
|
| KcContextBase.LogoutConfirm
|
||||||
| KcContextBase.UpdateUserProfile;
|
| KcContextBase.UpdateUserProfile
|
||||||
|
| KcContextBase.IdpReviewUserProfile;
|
||||||
|
|
||||||
export declare namespace KcContextBase {
|
export declare namespace KcContextBase {
|
||||||
export type Common = {
|
export type Common = {
|
||||||
@ -280,6 +281,14 @@ export declare namespace KcContextBase {
|
|||||||
attributesByName: Record<string, Attribute>;
|
attributesByName: Record<string, Attribute>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type IdpReviewUserProfile = Common & {
|
||||||
|
pageId: "idp-review-user-profile.ftl";
|
||||||
|
profile: {
|
||||||
|
attributes: Attribute[];
|
||||||
|
attributesByName: Record<string, Attribute>;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Attribute = {
|
export type Attribute = {
|
||||||
|
@ -47,8 +47,16 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
|
|||||||
"source": partialKcContextCustomMock
|
"source": partialKcContextCustomMock
|
||||||
});
|
});
|
||||||
|
|
||||||
if (partialKcContextCustomMock.pageId === "register-user-profile.ftl") {
|
if (
|
||||||
assert(kcContextDefaultMock?.pageId === "register-user-profile.ftl");
|
partialKcContextCustomMock.pageId === "register-user-profile.ftl" ||
|
||||||
|
partialKcContextCustomMock.pageId === "update-user-profile.ftl" ||
|
||||||
|
partialKcContextCustomMock.pageId === "idp-review-user-profile.ftl"
|
||||||
|
) {
|
||||||
|
assert(
|
||||||
|
kcContextDefaultMock?.pageId === "register-user-profile.ftl" ||
|
||||||
|
kcContextDefaultMock?.pageId === "update-user-profile.ftl" ||
|
||||||
|
kcContextDefaultMock?.pageId === "idp-review-user-profile.ftl"
|
||||||
|
);
|
||||||
|
|
||||||
const { attributes } = kcContextDefaultMock.profile;
|
const { attributes } = kcContextDefaultMock.profile;
|
||||||
|
|
||||||
@ -60,8 +68,6 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
|
|||||||
].filter(exclude(undefined));
|
].filter(exclude(undefined));
|
||||||
|
|
||||||
attributes.forEach(attribute => {
|
attributes.forEach(attribute => {
|
||||||
console.log("====>", attribute);
|
|
||||||
|
|
||||||
const partialAttribute = partialAttributes.find(({ name }) => name === attribute.name);
|
const partialAttribute = partialAttributes.find(({ name }) => name === attribute.name);
|
||||||
|
|
||||||
const augmentedAttribute: Attribute = {} as any;
|
const augmentedAttribute: Attribute = {} as any;
|
||||||
|
@ -430,5 +430,13 @@ export const kcContextMocks: KcContextBase[] = [
|
|||||||
attributes,
|
attributes,
|
||||||
attributesByName
|
attributesByName
|
||||||
}
|
}
|
||||||
|
}),
|
||||||
|
id<KcContextBase.IdpReviewUserProfile>({
|
||||||
|
...kcContextCommonMock,
|
||||||
|
"pageId": "idp-review-user-profile.ftl",
|
||||||
|
"profile": {
|
||||||
|
attributes,
|
||||||
|
attributesByName
|
||||||
|
}
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
Reference in New Issue
Block a user