Compare commits

..

14 Commits

15 changed files with 50 additions and 30 deletions

4
.gitattributes vendored
View File

@ -1,3 +1,3 @@
src/lib/i18n/generated_messages/* linguist-documentation
src/bin/build-keycloak-theme/index.ts -linguist-detectable
src/bin/download-sample-keycloak-themes.ts -linguist-detectable
src/bin/install-builtin-keycloak-themes.ts -linguist-detectable
src/bin/build-keycloak-theme/index.ts -linguist-detectable

View File

@ -1,3 +1,18 @@
### **0.0.32** (2021-03-05)
- bump version
- Add log to tell when we are using react
- Fix missing parentesis
### **0.0.31** (2021-03-05)
- Fix typo
- Fix register page 500
### **0.0.30** (2021-03-05)
- Edit language statistique
### **0.0.30** (2021-03-05)
- avoid escaping urls

View File

@ -6,13 +6,13 @@
"messagesPerField": {
"printIfExists": function (key, x) {
switch(key){
case "userLabel": "${messagesPerField.printIfExists('userLabel','1'}" ? x : undefined;
case "username": "${messagesPerField.printIfExists('username','1'}" ? x : undefined;
case "email": "${messagesPerField.printIfExists('email','1'}" ? x : undefined;
case "firstName": "${messagesPerField.printIfExists('firstName','1'}" ? x : undefined;
case "lastName": "${messagesPerField.printIfExists('lastName','1'}" ? x : undefined;
case "password": "${messagesPerField.printIfExists('password','1'}" ? x : undefined;
case "password-confirm": "${messagesPerField.printIfExists('password-confirm','1'}" ? x : undefined;
case "userLabel": "${messagesPerField.printIfExists('userLabel','1')}" ? x : undefined;
case "username": "${messagesPerField.printIfExists('username','1')}" ? x : undefined;
case "email": "${messagesPerField.printIfExists('email','1')}" ? x : undefined;
case "firstName": "${messagesPerField.printIfExists('firstName','1')}" ? x : undefined;
case "lastName": "${messagesPerField.printIfExists('lastName','1')}" ? x : undefined;
case "password": "${messagesPerField.printIfExists('password','1')}" ? x : undefined;
case "password-confirm": "${messagesPerField.printIfExists('password-confirm','1')}" ? x : undefined;
}
}
},
@ -41,6 +41,6 @@
return false;
})(),
"recaptchaSiteKey": "${recaptchaSiteKey}"
"recaptchaSiteKey": "${recaptchaSiteKey!''}" || undefined
}
</script>

View File

@ -90,7 +90,7 @@ function generateKeycloakThemeResources(params) {
child_process.execSync("rm -r " + tmpDirPath);
}
fs.writeFileSync(path_1.join(themeDirPath, "theme.properties"), Buffer.from([
"[import=common/" + themeName,
"import=common/" + themeName,
"locales=ca,cs,de,en,es,fr,it,ja,lt,nl,no,pl,pt-BR,ru,sk,sv,tr,zh-CN"
].join("\n"), "utf8"));
}

View File

@ -1 +1 @@
{"version":3,"file":"generateKeycloakThemeResources.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAA+D;AAC/D,qCAAyB;AACzB,6BAAwC;AACxC,qEAGmC;AACnC,6CAA4D;AAC5D,sFAAsE;AACtE,8DAA6D;AAC7D,2DAA+C;AAC/C,6DAA4D;AAE5D,SAAgB,8BAA8B,CAC1C,MAIC;IAGO,IAAA,SAAS,GAAyD,MAAM,UAA/D,EAAE,oBAAoB,GAAmC,MAAM,qBAAzC,EAAE,4BAA4B,GAAK,MAAM,6BAAX,CAAY;IAEjF,IAAM,YAAY,GAAG,WAAQ,CAAC,4BAA4B,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAErH,IAAI,qBAAqB,GAA2B,EAAE,CAAC;IAEvD,qCAAiB,CAAC;QACd,aAAa,EAAE,WAAQ,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC;QAC3D,YAAY,EAAE,oBAAoB;QAClC,qBAAqB,EAAE,UAAC,EAAwB;gBAAtB,QAAQ,cAAA,EAAE,UAAU,gBAAA;YAE1C,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAErB,IAAA,KAAuC,0DAAgC,CACzE,EAAE,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAC7C,EAFO,kBAAkB,wBAAA,EAAE,YAAY,kBAEv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gB;YACvB,aAAa,EAAE,UAAU;SAC5B,CAAC,CAAC;QAEH,qCAAiB,CAAC;YACd,YAAY,EAAE,WAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC;YACxD,aAAa,EAAE,WAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC;SACtD,CAAC,CAAC;QAEH,qCAAiB,CAAC;YACd,YAAY,EAAE,WAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC;YACpE,aAAa,EAAE,WAAQ,CAAC,YAAY,EAAE,WAAW,CAAC;SACrD,CAAC,CAAC;QAEH,aAAa,CAAC,QAAQ,CAAC,WAAS,UAAY,CAAC,CAAC;KAEjD;IAED,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAC1C,MAAM,CAAC,IAAI,CAAC;QACR,oBAAkB,SAAW;QAC7B,qEAAqE;KACxE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CACxB,CAAC;AAEN,CAAC;AApGD,wEAoGC"}
{"version":3,"file":"generateKeycloakThemeResources.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAA+D;AAC/D,qCAAyB;AACzB,6BAAwC;AACxC,qEAGmC;AACnC,6CAA4D;AAC5D,sFAAsE;AACtE,8DAA6D;AAC7D,2DAA+C;AAC/C,6DAA4D;AAE5D,SAAgB,8BAA8B,CAC1C,MAIC;IAGO,IAAA,SAAS,GAAyD,MAAM,UAA/D,EAAE,oBAAoB,GAAmC,MAAM,qBAAzC,EAAE,4BAA4B,GAAK,MAAM,6BAAX,CAAY;IAEjF,IAAM,YAAY,GAAG,WAAQ,CAAC,4BAA4B,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC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,CAAC,WAAW,EAAE,cAAc,CAAW,CAAC,OAAO,CAAC,UAAA,YAAY;QAEjD,IAAA,OAAO,GAAK,oBAAoB,CAAC,EAAE,YAAY,cAAA,EAAE,CAAC,QAA3C,CAA4C;QAE3D,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,YAAY,EAAE,YAAY,CAAC,EACpC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAC/B,CAAA;IAEL,CAAC,CAAC,CAAC;IAEH;QAEI,IAAM,UAAU,GAAG,WAAQ,CAAC,YAAY,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC;QAEnE,mCAAgB,CAAC;YACb,KAAK,EAAE,kDAAgB;YACvB,aAAa,EAAE,UAAU;SAC5B,CAAC,CAAC;QAEH,qCAAiB,CAAC;YACd,YAAY,EAAE,WAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC;YACxD,aAAa,EAAE,WAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC;SACtD,CAAC,CAAC;QAEH,qCAAiB,CAAC;YACd,YAAY,EAAE,WAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC;YACpE,aAAa,EAAE,WAAQ,CAAC,YAAY,EAAE,WAAW,CAAC;SACrD,CAAC,CAAC;QAEH,aAAa,CAAC,QAAQ,CAAC,WAAS,UAAY,CAAC,CAAC;KAEjD;IAED,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAC1C,MAAM,CAAC,IAAI,CAAC;QACR,mBAAiB,SAAW;QAC5B,qEAAqE;KACxE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CACxB,CAAC;AAEN,CAAC;AApGD,wEAoGC"}

View File

@ -48,6 +48,7 @@ var powerhooks_2 = require("powerhooks");
var KcProperties_1 = require("./KcProperties");
exports.Template = react_1.memo(function (props) {
var _a = props.displayInfo, displayInfo = _a === void 0 ? false : _a, _b = props.displayMessage, displayMessage = _b === void 0 ? true : _b, _c = props.displayRequiredFields, displayRequiredFields = _c === void 0 ? false : _c, _d = props.displayWide, displayWide = _d === void 0 ? false : _d, _e = props.showAnotherWayIfPresent, showAnotherWayIfPresent = _e === void 0 ? true : _e, _f = props.kcProperties, kcProperties = _f === void 0 ? {} : _f, headerNode = props.headerNode, _g = props.showUsernameNode, showUsernameNode = _g === void 0 ? null : _g, formNode = props.formNode, _h = props.displayInfoNode, displayInfoNode = _h === void 0 ? null : _h;
console.log("Rendering this page with react using keycloak-react-theming");
var t = useKcTranslation_1.useKcTranslation().t;
Object.assign(kcProperties, KcProperties_1.defaultKcTemplateProperties);
var _j = useKcLanguageTag_1.useKcLanguageTag(), kcLanguageTag = _j.kcLanguageTag, setKcLanguageTag = _j.setKcLanguageTag;

File diff suppressed because one or more lines are too long

3
lib/kcContext.d.ts vendored
View File

@ -85,7 +85,8 @@ export declare namespace KcContext {
};
passwordRequired: boolean;
recaptchaRequired: boolean;
recaptchaSiteKey: string;
/** undefined if !recaptchaRequired */
recaptchaSiteKey?: string;
};
}
export declare const kcContext: KcContext | undefined;

View File

@ -1 +1 @@
{"version":3,"file":"kcContext.js","sourceRoot":"","sources":["../src/lib/kcContext.ts"],"names":[],"mappings":";;;AACA,uFAAsF;AAEtF,8CAA6C;AAE7C,4DAA2D;AAmH3D;IAII,qBAAS,EAAQ,CAAC;IAClB,qBAAS,EAAQ,CAAC;CACrB;AAEY,QAAA,SAAS,GAAG,OAAE,CAAyB,MAAc,CAAC,yCAAmB,CAAC,CAAC,CAAC"}
{"version":3,"file":"kcContext.js","sourceRoot":"","sources":["../src/lib/kcContext.ts"],"names":[],"mappings":";;;AACA,uFAAsF;AAEtF,8CAA6C;AAE7C,4DAA2D;AAoH3D;IAII,qBAAS,EAAQ,CAAC;IAClB,qBAAS,EAAQ,CAAC;CACrB;AAEY,QAAA,SAAS,GAAG,OAAE,CAAyB,MAAc,CAAC,yCAAmB,CAAC,CAAC,CAAC"}

View File

@ -1,6 +1,6 @@
{
"name": "keycloak-react-theming",
"version": "0.0.30",
"version": "0.0.32",
"description": "Keycloak theme generator for Reacts app",
"repository": {
"type": "git",

View File

@ -6,13 +6,13 @@
"messagesPerField": {
"printIfExists": function (key, x) {
switch(key){
case "userLabel": "${messagesPerField.printIfExists('userLabel','1'}" ? x : undefined;
case "username": "${messagesPerField.printIfExists('username','1'}" ? x : undefined;
case "email": "${messagesPerField.printIfExists('email','1'}" ? x : undefined;
case "firstName": "${messagesPerField.printIfExists('firstName','1'}" ? x : undefined;
case "lastName": "${messagesPerField.printIfExists('lastName','1'}" ? x : undefined;
case "password": "${messagesPerField.printIfExists('password','1'}" ? x : undefined;
case "password-confirm": "${messagesPerField.printIfExists('password-confirm','1'}" ? x : undefined;
case "userLabel": "${messagesPerField.printIfExists('userLabel','1')}" ? x : undefined;
case "username": "${messagesPerField.printIfExists('username','1')}" ? x : undefined;
case "email": "${messagesPerField.printIfExists('email','1')}" ? x : undefined;
case "firstName": "${messagesPerField.printIfExists('firstName','1')}" ? x : undefined;
case "lastName": "${messagesPerField.printIfExists('lastName','1')}" ? x : undefined;
case "password": "${messagesPerField.printIfExists('password','1')}" ? x : undefined;
case "password-confirm": "${messagesPerField.printIfExists('password-confirm','1')}" ? x : undefined;
}
}
},
@ -41,6 +41,6 @@
return false;
})(),
"recaptchaSiteKey": "${recaptchaSiteKey}"
"recaptchaSiteKey": "${recaptchaSiteKey!''}" || undefined
}
</script>

View File

@ -107,7 +107,7 @@ export function generateKeycloakThemeResources(
fs.writeFileSync(
pathJoin(themeDirPath, "theme.properties"),
Buffer.from([
`[import=common/${themeName}`,
`import=common/${themeName}`,
"locales=ca,cs,de,en,es,fr,it,ja,lt,nl,no,pl,pt-BR,ru,sk,sv,tr,zh-CN"
].join("\n"), "utf8")
);

View File

@ -44,6 +44,8 @@ export const Template = memo((props: TemplateProps) => {
displayInfoNode = null
} = props;
console.log("Rendering this page with react using keycloak-react-theming");
const { t } = useKcTranslation();
Object.assign(kcProperties, defaultKcTemplateProperties);

View File

@ -113,7 +113,8 @@ export declare namespace KcContext {
};
passwordRequired: boolean;
recaptchaRequired: boolean;
recaptchaSiteKey: string;
/** undefined if !recaptchaRequired */
recaptchaSiteKey?: string;
};
}

View File

@ -302,7 +302,7 @@
"affectsGlobalScope": false
},
"../src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts": {
"version": "0ae0e8e72513c2ef314d46094409de33465767f1dae5227e7e84f9bbc06cd3cd",
"version": "3b157cb7ca410693dcb16ba0d278af239d428b354587845defbea49caf15b3a5",
"signature": "c53e9172d81232fc2b183d2105ce6b33db0803cdb01c188755460b66b9e7bf35",
"affectsGlobalScope": false
},
@ -357,8 +357,8 @@
"affectsGlobalScope": false
},
"../src/lib/kcContext.ts": {
"version": "09ff090d2fd6bd444d83eb83ca212235f618ee7fe41cd7420a60b54c18efcb12",
"signature": "e428ab0c80aa95c42c83b1f566621ede0def2602c580e4ea7d2ee64d50496b64",
"version": "a2e6407364f99da22365640252546c9026ccb6b433825c74a102812f01353c60",
"signature": "f0c3959b08d47a8cf4fa61a1269813d31bb3591141c3345aa19c610e0bed0b17",
"affectsGlobalScope": false
},
"../node_modules/powerhooks/useArrayDiff.d.ts": {
@ -507,7 +507,7 @@
"affectsGlobalScope": false
},
"../src/lib/components/Template.tsx": {
"version": "b00d9dc082b84094570662473c6be4f2466e73014e39075e32fcf339b9b17cdd",
"version": "5d092f14d57b8473a145da9259832d2daabb048c09be6f6c47d80f7956a89e81",
"signature": "0df5b249e080078896457b419b957c2bbf8e5a9bf8b9968d14a3de5bca6ea02f",
"affectsGlobalScope": false
},