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",
|
||||
"version": "10.0.0-rc.93",
|
||||
"version": "10.0.0-rc.96",
|
||||
"description": "Create Keycloak themes using React",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -10,7 +10,7 @@ fs.rmSync(".yarn_home", { recursive: true, force: true });
|
||||
run("yarn install");
|
||||
run("yarn build");
|
||||
|
||||
const starterName = "keycloakify-starter-webpack";
|
||||
const starterName = "keycloakify-starter";
|
||||
|
||||
fs.rmSync(join("..", starterName, "node_modules"), {
|
||||
recursive: true,
|
||||
|
@ -81,7 +81,8 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
||||
)
|
||||
)
|
||||
.toString("utf8")
|
||||
.replace('import React from "react";\n', "");
|
||||
.replace('import React from "react";\n', "")
|
||||
.replace(/from "[./]+dist\//, 'from "keycloakify/');
|
||||
|
||||
{
|
||||
const targetDirPath = pathDirname(targetFilePath);
|
||||
|
@ -35,8 +35,8 @@ export function readExtraPagesNames(params: {
|
||||
|
||||
extraPages.push(
|
||||
...Array.from(
|
||||
rawSourceFile.matchAll(/["']?pageId["']?\s*:\s*["']([^.]+.ftl)["']/g),
|
||||
m => m[1]
|
||||
rawSourceFile.matchAll(/["']([^.\s]+.ftl)["']:/g),
|
||||
m => (console.log(m), m[1])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import * as child_process from "child_process";
|
||||
import { Deferred } from "evt/tools/Deferred";
|
||||
import { assert } from "tsafe/assert";
|
||||
import type { BuildContext } from "../shared/buildContext";
|
||||
import chalk from "chalk";
|
||||
|
||||
export type BuildContextLike = {
|
||||
projectDirPath: string;
|
||||
@ -19,6 +20,8 @@ export async function keycloakifyBuild(params: {
|
||||
|
||||
const dResult = new Deferred<{ isSuccess: boolean }>();
|
||||
|
||||
console.log(chalk.blue("Running: 'npx keycloakify build'"));
|
||||
|
||||
const child = child_process.spawn("npx", ["keycloakify", "build"], {
|
||||
cwd: buildContext.projectDirPath,
|
||||
env: {
|
||||
|
@ -259,8 +259,16 @@ function createI18nTranslationFunctionsFactory<MessageKey extends string, ExtraM
|
||||
function resolveMsgAdvanced(props: { key: string; args: (string | undefined)[]; doRenderAsHtml: boolean }): JSX.Element | string {
|
||||
const { key, args, doRenderAsHtml } = props;
|
||||
|
||||
if (realmMessageBundleUserProfile !== undefined && key in realmMessageBundleUserProfile) {
|
||||
const resolvedMessage = realmMessageBundleUserProfile[key];
|
||||
user_profile: {
|
||||
if (realmMessageBundleUserProfile === undefined) {
|
||||
break user_profile;
|
||||
}
|
||||
|
||||
const resolvedMessage = realmMessageBundleUserProfile[key] ?? realmMessageBundleUserProfile["${" + key + "}"];
|
||||
|
||||
if (resolvedMessage === undefined) {
|
||||
break user_profile;
|
||||
}
|
||||
|
||||
return doRenderAsHtml ? (
|
||||
<span
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { createKcPageStory } from "../KcPageStory";
|
||||
import type { Attribute } from "../../../dist/login";
|
||||
|
||||
const { KcPageStory } = createKcPageStory({ pageId: "register.ftl" });
|
||||
|
||||
@ -48,23 +49,84 @@ export const WithEmailAlreadyExists: Story = {
|
||||
)
|
||||
};
|
||||
|
||||
export const WithEmailAsUsername: Story = {
|
||||
export const WithRestrictedToMITStudents: Story = {
|
||||
render: () => (
|
||||
<KcPageStory
|
||||
kcContext={{
|
||||
realm: {
|
||||
registrationEmailAsUsername: true
|
||||
profile: {
|
||||
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: () => (
|
||||
<KcPageStory
|
||||
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 = {
|
||||
render: () => (
|
||||
<KcPageStory
|
||||
|
Reference in New Issue
Block a user