Social is now optional on the kcContext

This commit is contained in:
Joseph Garrone 2024-09-09 07:51:49 +02:00
parent 28990a12da
commit b8a08f0789
4 changed files with 5 additions and 17 deletions

View File

@ -188,7 +188,7 @@ export declare namespace KcContext {
password?: string; password?: string;
}; };
usernameHidden?: boolean; usernameHidden?: boolean;
social: { social?: {
displayInfo: boolean; displayInfo: boolean;
providers?: { providers?: {
loginUrl: string; loginUrl: string;
@ -325,7 +325,7 @@ export declare namespace KcContext {
rememberMe?: string; rememberMe?: string;
}; };
usernameHidden?: boolean; usernameHidden?: boolean;
social: Login["social"]; social?: Login["social"];
}; };
export type LoginPassword = Common & { export type LoginPassword = Common & {
@ -343,9 +343,6 @@ export declare namespace KcContext {
showTryAnotherWayLink?: boolean; showTryAnotherWayLink?: boolean;
attemptedUsername?: string; attemptedUsername?: string;
}; };
social: {
displayInfo: boolean;
};
}; };
export type WebauthnAuthenticate = Common & { export type WebauthnAuthenticate = Common & {
@ -360,9 +357,6 @@ export declare namespace KcContext {
createTimeout: string; createTimeout: string;
isUserIdentified: "true" | "false"; isUserIdentified: "true" | "false";
shouldDisplayAuthenticators: boolean; shouldDisplayAuthenticators: boolean;
social: {
displayInfo: boolean;
};
login: {}; login: {};
realm: { realm: {
password: boolean; password: boolean;

View File

@ -326,9 +326,6 @@ export const kcContextMocks = [
realm: { realm: {
...kcContextCommonMock.realm, ...kcContextCommonMock.realm,
resetPasswordAllowed: true resetPasswordAllowed: true
},
social: {
displayInfo: false
} }
}), }),
id<KcContext.WebauthnAuthenticate>({ id<KcContext.WebauthnAuthenticate>({
@ -349,9 +346,6 @@ export const kcContextMocks = [
createTimeout: "0", createTimeout: "0",
isUserIdentified: "false", isUserIdentified: "false",
shouldDisplayAuthenticators: false, shouldDisplayAuthenticators: false,
social: {
displayInfo: false
},
login: {} login: {}
}), }),
id<KcContext.LoginUpdatePassword>({ id<KcContext.LoginUpdatePassword>({
@ -584,7 +578,7 @@ export const kcContextMocks = [
challenge: "", challenge: "",
userVerification: "not specified", userVerification: "not specified",
rpId: "", rpId: "",
createTimeout: "0", createTimeout: 0,
authenticators: { authenticators: {
authenticators: [] authenticators: []
}, },

View File

@ -43,7 +43,7 @@ export default function Login(props: PageProps<Extract<KcContext, { pageId: "log
} }
socialProvidersNode={ socialProvidersNode={
<> <>
{realm.password && social.providers !== undefined && social.providers.length !== 0 && ( {realm.password && social?.providers !== undefined && social.providers.length !== 0 && (
<div id="kc-social-providers" className={kcClsx("kcFormSocialAccountSectionClass")}> <div id="kc-social-providers" className={kcClsx("kcFormSocialAccountSectionClass")}>
<hr /> <hr />
<h2>{msg("identity-provider-login-label")}</h2> <h2>{msg("identity-provider-login-label")}</h2>

View File

@ -40,7 +40,7 @@ export default function LoginUsername(props: PageProps<Extract<KcContext, { page
headerNode={msg("doLogIn")} headerNode={msg("doLogIn")}
socialProvidersNode={ socialProvidersNode={
<> <>
{realm.password && social.providers !== undefined && social.providers.length !== 0 && ( {realm.password && social?.providers !== undefined && social.providers.length !== 0 && (
<div id="kc-social-providers" className={kcClsx("kcFormSocialAccountSectionClass")}> <div id="kc-social-providers" className={kcClsx("kcFormSocialAccountSectionClass")}>
<hr /> <hr />
<h2>{msg("identity-provider-login-label")}</h2> <h2>{msg("identity-provider-login-label")}</h2>