Compare commits
8 Commits
v10.0.0-rc
...
v10.0.0-rc
Author | SHA1 | Date | |
---|---|---|---|
a51724208c | |||
050e2b2b99 | |||
3706f15f7e | |||
7461e38034 | |||
dccd85a151 | |||
910604fdad | |||
508cb9158e | |||
915c500d32 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "keycloakify",
|
"name": "keycloakify",
|
||||||
"version": "10.0.0-rc.93",
|
"version": "10.0.0-rc.96",
|
||||||
"description": "Create Keycloak themes using React",
|
"description": "Create Keycloak themes using React",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -10,7 +10,7 @@ fs.rmSync(".yarn_home", { recursive: true, force: true });
|
|||||||
run("yarn install");
|
run("yarn install");
|
||||||
run("yarn build");
|
run("yarn build");
|
||||||
|
|
||||||
const starterName = "keycloakify-starter-webpack";
|
const starterName = "keycloakify-starter";
|
||||||
|
|
||||||
fs.rmSync(join("..", starterName, "node_modules"), {
|
fs.rmSync(join("..", starterName, "node_modules"), {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
|
@ -81,7 +81,8 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
.toString("utf8")
|
.toString("utf8")
|
||||||
.replace('import React from "react";\n', "");
|
.replace('import React from "react";\n', "")
|
||||||
|
.replace(/from "[./]+dist\//, 'from "keycloakify/');
|
||||||
|
|
||||||
{
|
{
|
||||||
const targetDirPath = pathDirname(targetFilePath);
|
const targetDirPath = pathDirname(targetFilePath);
|
||||||
|
@ -35,8 +35,8 @@ export function readExtraPagesNames(params: {
|
|||||||
|
|
||||||
extraPages.push(
|
extraPages.push(
|
||||||
...Array.from(
|
...Array.from(
|
||||||
rawSourceFile.matchAll(/["']?pageId["']?\s*:\s*["']([^.]+.ftl)["']/g),
|
rawSourceFile.matchAll(/["']([^.\s]+.ftl)["']:/g),
|
||||||
m => m[1]
|
m => (console.log(m), m[1])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import * as child_process from "child_process";
|
|||||||
import { Deferred } from "evt/tools/Deferred";
|
import { Deferred } from "evt/tools/Deferred";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import type { BuildContext } from "../shared/buildContext";
|
import type { BuildContext } from "../shared/buildContext";
|
||||||
|
import chalk from "chalk";
|
||||||
|
|
||||||
export type BuildContextLike = {
|
export type BuildContextLike = {
|
||||||
projectDirPath: string;
|
projectDirPath: string;
|
||||||
@ -19,6 +20,8 @@ export async function keycloakifyBuild(params: {
|
|||||||
|
|
||||||
const dResult = new Deferred<{ isSuccess: boolean }>();
|
const dResult = new Deferred<{ isSuccess: boolean }>();
|
||||||
|
|
||||||
|
console.log(chalk.blue("Running: 'npx keycloakify build'"));
|
||||||
|
|
||||||
const child = child_process.spawn("npx", ["keycloakify", "build"], {
|
const child = child_process.spawn("npx", ["keycloakify", "build"], {
|
||||||
cwd: buildContext.projectDirPath,
|
cwd: buildContext.projectDirPath,
|
||||||
env: {
|
env: {
|
||||||
|
@ -259,8 +259,16 @@ function createI18nTranslationFunctionsFactory<MessageKey extends string, ExtraM
|
|||||||
function resolveMsgAdvanced(props: { key: string; args: (string | undefined)[]; doRenderAsHtml: boolean }): JSX.Element | string {
|
function resolveMsgAdvanced(props: { key: string; args: (string | undefined)[]; doRenderAsHtml: boolean }): JSX.Element | string {
|
||||||
const { key, args, doRenderAsHtml } = props;
|
const { key, args, doRenderAsHtml } = props;
|
||||||
|
|
||||||
if (realmMessageBundleUserProfile !== undefined && key in realmMessageBundleUserProfile) {
|
user_profile: {
|
||||||
const resolvedMessage = realmMessageBundleUserProfile[key];
|
if (realmMessageBundleUserProfile === undefined) {
|
||||||
|
break user_profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
const resolvedMessage = realmMessageBundleUserProfile[key] ?? realmMessageBundleUserProfile["${" + key + "}"];
|
||||||
|
|
||||||
|
if (resolvedMessage === undefined) {
|
||||||
|
break user_profile;
|
||||||
|
}
|
||||||
|
|
||||||
return doRenderAsHtml ? (
|
return doRenderAsHtml ? (
|
||||||
<span
|
<span
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import type { Meta, StoryObj } from "@storybook/react";
|
import type { Meta, StoryObj } from "@storybook/react";
|
||||||
import { createKcPageStory } from "../KcPageStory";
|
import { createKcPageStory } from "../KcPageStory";
|
||||||
|
import type { Attribute } from "../../../dist/login";
|
||||||
|
|
||||||
const { KcPageStory } = createKcPageStory({ pageId: "register.ftl" });
|
const { KcPageStory } = createKcPageStory({ pageId: "register.ftl" });
|
||||||
|
|
||||||
@ -48,23 +49,84 @@ export const WithEmailAlreadyExists: Story = {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithEmailAsUsername: Story = {
|
export const WithRestrictedToMITStudents: Story = {
|
||||||
render: () => (
|
render: () => (
|
||||||
<KcPageStory
|
<KcPageStory
|
||||||
kcContext={{
|
kcContext={{
|
||||||
realm: {
|
profile: {
|
||||||
registrationEmailAsUsername: true
|
attributesByName: {
|
||||||
|
email: {
|
||||||
|
validators: {
|
||||||
|
pattern: {
|
||||||
|
pattern: "^[^@]+@([^.]+\\.)*((mit\\.edu)|(berkeley\\.edu))$",
|
||||||
|
"error-message": "${profile.attributes.email.pattern.error}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
annotations: {
|
||||||
|
inputHelperTextBefore: "${profile.attributes.email.inputHelperTextBefore}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-keycloakify": {
|
||||||
|
realmMessageBundleUserProfile: {
|
||||||
|
"${profile.attributes.email.inputHelperTextBefore}": "Please use your MIT or Berkeley email.",
|
||||||
|
"${profile.attributes.email.pattern.error}":
|
||||||
|
"This is not an MIT (<strong>@mit.edu</strong>) nor a Berkeley (<strong>@berkeley.edu</strong>) email."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithoutPassword: Story = {
|
export const WithFavoritePet: Story = {
|
||||||
render: () => (
|
render: () => (
|
||||||
<KcPageStory
|
<KcPageStory
|
||||||
kcContext={{
|
kcContext={{
|
||||||
passwordRequired: false
|
profile: {
|
||||||
|
attributesByName: {
|
||||||
|
favoritePet: {
|
||||||
|
name: "favorite-pet",
|
||||||
|
displayName: "${profile.attributes.favoritePet}",
|
||||||
|
validators: {
|
||||||
|
options: {
|
||||||
|
options: ["cat", "dog", "fish"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
annotations: {
|
||||||
|
inputOptionLabelsI18nPrefix: "profile.attributes.favoritePet.options"
|
||||||
|
},
|
||||||
|
required: false,
|
||||||
|
readOnly: false
|
||||||
|
} satisfies Attribute
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-keycloakify": {
|
||||||
|
realmMessageBundleUserProfile: {
|
||||||
|
"${profile.attributes.favoritePet}": "Favorite Pet",
|
||||||
|
"${profile.attributes.favoritePet.options.cat}": "Fluffy Cat",
|
||||||
|
"${profile.attributes.favoritePet.options.dog}": "Loyal Dog",
|
||||||
|
"${profile.attributes.favoritePet.options.fish}": "Peaceful Fish"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
export const WithEmailAsUsername: Story = {
|
||||||
|
render: () => (
|
||||||
|
<KcPageStory
|
||||||
|
kcContext={{
|
||||||
|
realm: {
|
||||||
|
registrationEmailAsUsername: true
|
||||||
|
},
|
||||||
|
profile: {
|
||||||
|
attributesByName: {
|
||||||
|
username: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@ -97,31 +159,6 @@ export const WithRecaptchaFrench: Story = {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithPresets: Story = {
|
|
||||||
render: () => (
|
|
||||||
<KcPageStory
|
|
||||||
kcContext={{
|
|
||||||
profile: {
|
|
||||||
attributesByName: {
|
|
||||||
firstName: {
|
|
||||||
value: "Max"
|
|
||||||
},
|
|
||||||
lastName: {
|
|
||||||
value: "Mustermann"
|
|
||||||
},
|
|
||||||
email: {
|
|
||||||
value: "max.mustermann@gmail.com"
|
|
||||||
},
|
|
||||||
username: {
|
|
||||||
value: "max.mustermann"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
export const WithPasswordMinLength8: Story = {
|
export const WithPasswordMinLength8: Story = {
|
||||||
render: () => (
|
render: () => (
|
||||||
<KcPageStory
|
<KcPageStory
|
||||||
|
Reference in New Issue
Block a user