From 38062af8895b6c176a4799a48bdb539008188e9c Mon Sep 17 00:00:00 2001 From: garronej Date: Tue, 7 Dec 2021 15:20:37 +0100 Subject: [PATCH 01/72] Add info with pages taking too long to load #58 (changelog ignore) --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 57e0d08f..b6dc5d89 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ If you already have a Keycloak custom theme, it can be easily ported to Keycloak - [Implement context persistence (optional)](#implement-context-persistence-optional) - [Kickstart video](#kickstart-video) - [About the errors related to `objectToJson` in Keycloak logs.](#about-the-errors-related-to-objecttojson-in-keycloak-logs) +- [The pages take too long to load ?](#the-pages-take-too-long-to-load-) - [Adding custom message (to `i18n/useKcMessage.tsx`)](#adding-custom-message-to-i18nusekcmessagetsx) - [Email domain whitelist](#email-domain-whitelist) - [Changelog highlights](#changelog-highlights) @@ -461,6 +462,10 @@ To [converts the `.ftl` values into a JavaScript object](https://github.com/Inse without making assumptions on the `.data_model` we have to do things that throws. It's all-right because every statement that can fail is inside an `<#attempt><#recorver>` block but it results in errors being printed to the logs. +# The pages take too long to load ? + +The problem of templates taking a long time to load only happens in the test environment, when you have a console logging all the above-mentioned `.ftl` warnings in real time. Logging all those warnings is what takes time. Once in production page load is way faster. + # Adding custom message (to `i18n/useKcMessage.tsx`) You can reproduce [this approach](https://github.com/garronej/keycloakify-demo-app/blob/main/src/kcMessagesExtension.ts) From be0f244c025539774ded58885acb5a3171448a2b Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 00:21:36 +0100 Subject: [PATCH 02/72] Update tss-react (changelog ignore) --- package.json | 4 +- yarn.lock | 152 ++++++++------------------------------------------- 2 files changed, 24 insertions(+), 132 deletions(-) diff --git a/package.json b/package.json index 31058b86..3675b7e4 100755 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "@emotion/react": "^11.4.1", "powerhooks": "^0.10.0", "react": "^16.8.0 || ^17.0.0", - "tss-react": "^1.1.0" + "tss-react": "^1.1.0 || ^3.0.0" }, "devDependencies": { "@emotion/react": "^11.4.1", @@ -72,7 +72,7 @@ "properties-parser": "^0.3.1", "react": "^17.0.1", "rimraf": "^3.0.2", - "tss-react": "^1.1.0", + "tss-react": "^3.0.0", "typescript": "^4.2.3" }, "dependencies": { diff --git a/yarn.lock b/yarn.lock index 158bac57..09ed3ffa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -64,7 +64,7 @@ "@emotion/weak-memoize" "^0.2.5" hoist-non-react-statics "^3.3.1" -"@emotion/serialize@^1.0.2": +"@emotion/serialize@*", "@emotion/serialize@^1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-1.0.2.tgz#77cb21a0571c9f68eb66087754a65fa97bfcd965" integrity sha512-95MgNJ9+/ajxU7QIAruiOAdYNjxZX7G2mhgrtDWswA21VviYIRP1R5QilZ/bDY42xiKsaktP4egJb3QdYQZi1A== @@ -75,16 +75,6 @@ "@emotion/utils" "^1.0.0" csstype "^3.0.2" -"@emotion/server@^11.4.0": - version "11.4.0" - resolved "https://registry.yarnpkg.com/@emotion/server/-/server-11.4.0.tgz#3ae1d74cb31c7d013c3c76e88c0c4439076e9f66" - integrity sha512-IHovdWA3V0DokzxLtUNDx4+hQI82zUXqQFcVz/om2t44O0YSc+NHB+qifnyAOoQwt3SXcBTgaSntobwUI9gnfA== - dependencies: - "@emotion/utils" "^1.0.0" - html-tokenize "^2.0.0" - multipipe "^1.0.2" - through "^2.3.8" - "@emotion/sheet@^1.0.0", "@emotion/sheet@^1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@emotion/sheet/-/sheet-1.0.2.tgz#1d9ffde531714ba28e62dac6a996a8b1089719d0" @@ -95,7 +85,7 @@ resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed" integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== -"@emotion/utils@^1.0.0": +"@emotion/utils@*", "@emotion/utils@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-1.0.0.tgz#abe06a83160b10570816c913990245813a2fd6af" integrity sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA== @@ -220,11 +210,6 @@ braces@^3.0.1: dependencies: fill-range "^7.0.1" -buffer-from@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-0.1.2.tgz#15f4b9bcef012044df31142c14333caf6e0260d0" - integrity sha512-RiWIenusJsmI2KcvqQABB83tLxCByE3upSP8QU3rJDMVFGPWLvPQJt/O1Su9moRWeH7d+Q2HYb68f6+v+tw2vg== - callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -452,7 +437,7 @@ domelementtype@^2.0.1, domelementtype@^2.2.0: resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.2.0.tgz#9a0b6c2782ed6a1c7323d42267183df9bd8b1d57" integrity sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A== -domhandler@4.2.2, domhandler@^4.0, domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.2.2: +domhandler@^4.0, domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.2.2.tgz#e825d721d19a86b8c201a35264e226c678ee755f" integrity sha512-PzE9aBMsdZO8TK4BnuJwH0QT41wgMbRzuZrHUcpYncEjmQazq8QEaBWgLG7ZyC/DAZKEgglpIA6j4Qn/HmxS3w== @@ -468,13 +453,6 @@ domutils@^2.5.2, domutils@^2.6.0, domutils@^2.7.0, domutils@^2.8.0: domelementtype "^2.2.0" domhandler "^4.2.0" -duplexer2@^0.1.2: - version "0.1.4" - resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" - integrity sha1-ixLauHjA1p4+eJEFFmKjL8a93ME= - dependencies: - readable-stream "^2.0.2" - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -665,24 +643,6 @@ hoist-non-react-statics@^3.3.1: dependencies: react-is "^16.7.0" -html-dom-parser@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/html-dom-parser/-/html-dom-parser-1.0.2.tgz#bb5ff844f214657d899aa4fb7b0a9e7d15607e96" - integrity sha512-Jq4oVkVSn+10ut3fyc2P/Fs1jqTo0l45cP6Q8d2ef/9jfkYwulO0QXmyLI0VUiZrXF4czpGgMEJRa52CQ6Fk8Q== - dependencies: - domhandler "4.2.2" - htmlparser2 "6.1.0" - -html-react-parser@^1.2.7: - version "1.4.0" - resolved "https://registry.yarnpkg.com/html-react-parser/-/html-react-parser-1.4.0.tgz#bf264f38b9fdf4d94e2120f6a39586c15cb81bd0" - integrity sha512-v8Kxy+7L90ZFSM690oJWBNRzZWZOQquYPpQt6kDQPzQyZptXgOJ69kHSi7xdqNdm1mOfsDPwF4K9Bo/dS5gRTQ== - dependencies: - domhandler "4.2.2" - html-dom-parser "1.0.2" - react-property "2.0.0" - style-to-js "1.1.0" - html-to-react@^1.3.4: version "1.4.7" resolved "https://registry.yarnpkg.com/html-to-react/-/html-to-react-1.4.7.tgz#a58129c1b77c6d4e047a647372bd194e25420b89" @@ -693,18 +653,7 @@ html-to-react@^1.3.4: lodash.camelcase "^4.3.0" ramda "^0.27.1" -html-tokenize@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/html-tokenize/-/html-tokenize-2.0.1.tgz#c3b2ea6e2837d4f8c06693393e9d2a12c960be5f" - integrity sha512-QY6S+hZ0f5m1WT8WffYN+Hg+xm/w5I8XeUcAq/ZYP5wVC8xbKi4Whhru3FtrAebD5EhBW8rmFzkDI6eCAuFe2w== - dependencies: - buffer-from "~0.1.1" - inherits "~2.0.1" - minimist "~1.2.5" - readable-stream "~1.0.27-1" - through2 "~0.4.1" - -htmlparser2@6.1.0, htmlparser2@^6.1.0: +htmlparser2@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-6.1.0.tgz#c4d762b6c3371a05dbe65e94ae43a9f845fb8fb7" integrity sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A== @@ -771,11 +720,6 @@ inherits@2, inherits@^2.0.1, inherits@~2.0.1, inherits@~2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -inline-style-parser@0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1" - integrity sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q== - is-alphabetical@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/is-alphabetical/-/is-alphabetical-1.0.4.tgz#9e7d6b94916be22153745d184c298cbf986a686d" @@ -1018,11 +962,6 @@ minimatch@^3.0.3, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@~1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" @@ -1033,14 +972,6 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -multipipe@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/multipipe/-/multipipe-1.0.2.tgz#cc13efd833c9cda99f224f868461b8e1a3fd939d" - integrity sha1-zBPv2DPJzamfIk+GhGG44aP9k50= - dependencies: - duplexer2 "^0.1.2" - object-assign "^4.1.0" - next-tick@1, next-tick@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" @@ -1078,16 +1009,11 @@ nth-check@^2.0.0: dependencies: boolbase "^1.0.0" -object-assign@^4.1.0, object-assign@^4.1.1: +object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= -object-keys@~0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336" - integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY= - once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -1275,11 +1201,6 @@ react-markdown@^5.0.3: unist-util-visit "^2.0.0" xtend "^4.0.1" -react-property@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/react-property/-/react-property-2.0.0.tgz#2156ba9d85fa4741faf1918b38efc1eae3c6a136" - integrity sha512-kzmNjIgU32mO4mmH5+iUyrqlpFQhF8K2k7eZ4fdLSOPFrD1XgEuSBv9LDEgxRXTMBqMd8ppT0x6TIzqE5pdGdw== - react@^17.0.1: version "17.0.2" resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" @@ -1288,7 +1209,17 @@ react@^17.0.1: loose-envify "^1.1.0" object-assign "^4.1.1" -readable-stream@^2.0.2, readable-stream@~2.3.6: +readable-stream@~1.0.31: + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +readable-stream@~2.3.6: version "2.3.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== @@ -1301,16 +1232,6 @@ readable-stream@^2.0.2, readable-stream@~2.3.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@~1.0.17, readable-stream@~1.0.27-1, readable-stream@~1.0.31: - version "1.0.34" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" - integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - regenerator-runtime@^0.13.4: version "0.13.9" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" @@ -1479,20 +1400,6 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -style-to-js@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/style-to-js/-/style-to-js-1.1.0.tgz#631cbb20fce204019b3aa1fcb5b69d951ceac4ac" - integrity sha512-1OqefPDxGrlMwcbfpsTVRyzwdhr4W0uxYQzeA2F1CBc8WG04udg2+ybRnvh3XYL4TdHQrCahLtax2jc8xaE6rA== - dependencies: - style-to-object "0.3.0" - -style-to-object@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/style-to-object/-/style-to-object-0.3.0.tgz#b1b790d205991cc783801967214979ee19a76e46" - integrity sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA== - dependencies: - inline-style-parser "0.1.1" - stylis@^4.0.3: version "4.0.10" resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.0.10.tgz#446512d1097197ab3f02fb3c258358c3f7a14240" @@ -1527,14 +1434,6 @@ through2@^2.0.1: readable-stream "~2.3.6" xtend "~4.0.1" -through2@~0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/through2/-/through2-0.4.2.tgz#dbf5866031151ec8352bb6c4db64a2292a840b9b" - integrity sha1-2/WGYDEVHsg1K7bE22SiKSqEC5s= - dependencies: - readable-stream "~1.0.17" - xtend "~2.1.1" - through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -1580,13 +1479,13 @@ tslib@^2.2.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== -tss-react@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/tss-react/-/tss-react-1.1.0.tgz#bbbf12b3d30eb02e1a39ac6dba4ca05a9c6bb674" - integrity sha512-0UUQaMCbefyXsHesnScLwmoo6lD5sdAVR1h5dgIvCOFTk0i5A5a68K2B9gm89hQFfIKPl7fzolCsJ+G9RE/vpw== +tss-react@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/tss-react/-/tss-react-3.0.0.tgz#b084e1d10d1ea23c925b6a2141c1e91a0c5e9a2d" + integrity sha512-aZ/DZEuUvqki/1TKKBM4OmRx6TI5lcaF4BLMo0D8lyT/5S7zRFaAdVfAlsirHcQNgOAdf5IjLUcEbCYWcY6PJw== dependencies: - "@emotion/server" "^11.4.0" - html-react-parser "^1.2.7" + "@emotion/serialize" "*" + "@emotion/utils" "*" type-fest@^0.21.3: version "0.21.3" @@ -1722,13 +1621,6 @@ xtend@^4.0.1, xtend@~4.0.1: resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== -xtend@~2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b" - integrity sha1-bv7MKk2tjmlixJAbM3znuoe10os= - dependencies: - object-keys "~0.4.0" - y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" From 4a422cc796504aca79356e0a189ddd43a70cf6e4 Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 00:22:40 +0100 Subject: [PATCH 03/72] Bump (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3675b7e4..8d2c78e0 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.10", + "version": "4.2.11", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From bb1ada6e14c08eb1aacd119739ae03583bb43a73 Mon Sep 17 00:00:00 2001 From: actions Date: Tue, 7 Dec 2021 23:27:11 +0000 Subject: [PATCH 04/72] Update changelog v4.2.11 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76d10b8b..79433426 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### **4.2.11** (2021-12-07) + + + ### **4.2.10** (2021-11-12) - Export an exaustive list of KcLanguageTag From 303e270b567ccafd841f9b2ef29e7ec12a908411 Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 13:52:16 +0100 Subject: [PATCH 05/72] Add instruction for building on windows (changelog ignore) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b6dc5d89..56c0845e 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ If you already have a Keycloak custom theme, it can be easily ported to Keycloak # Requirements +On Windows OS you'll have to use [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10). More info [here](https://github.com/InseeFrLab/keycloakify/issues/54%23issuecomment-984834217) + Tested with the following Keycloak versions: - [11.0.3](https://hub.docker.com/layers/jboss/keycloak/11.0.3/images/sha256-4438f1e51c1369371cb807dffa526e1208086b3ebb9cab009830a178de949782?context=explore) @@ -107,8 +109,6 @@ For more information see [this issue](https://github.com/InseeFrLab/keycloakify/ - `mvn` ([Maven](https://maven.apache.org/)), `rm`, `mkdir`, `curl`, `unzip` are assumed to be available. - `docker` must be up and running when running `yarn keycloak`. -On Windows you'll have to use [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10). - ## My framework doesnโ€™t seem to be supported, what can I do? Currently Keycloakify is only compatible with `create-react-app` apps. From 84937e3eec3e7cb853956544200a789e520bda94 Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 13:56:06 +0100 Subject: [PATCH 06/72] Update notice about long loading time (changelog ignore) --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 56c0845e..bcb1fa35 100644 --- a/README.md +++ b/README.md @@ -466,6 +466,11 @@ It's all-right because every statement that can fail is inside an `<#attempt><#r The problem of templates taking a long time to load only happens in the test environment, when you have a console logging all the above-mentioned `.ftl` warnings in real time. Logging all those warnings is what takes time. Once in production page load is way faster. +If you run the docker container locally we aknowelage that the loading time is getting out of hand. +We are [in the process](https://github.com/InseeFrLab/keycloakify/pull/63) of resolving this issue. + +In the meantime we recommend to run the docker container as a background task. + # Adding custom message (to `i18n/useKcMessage.tsx`) You can reproduce [this approach](https://github.com/garronej/keycloakify-demo-app/blob/main/src/kcMessagesExtension.ts) From 47c6d0dd626404a765c406399a8bf1fa77fcb8db Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 14:12:35 +0100 Subject: [PATCH 07/72] Update post build instructions --- src/bin/build-keycloak-theme/build-keycloak-theme.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bin/build-keycloak-theme/build-keycloak-theme.ts b/src/bin/build-keycloak-theme/build-keycloak-theme.ts index dd599d2b..41cae1fe 100644 --- a/src/bin/build-keycloak-theme/build-keycloak-theme.ts +++ b/src/bin/build-keycloak-theme/build-keycloak-theme.ts @@ -121,11 +121,13 @@ export function main() { "", `๐Ÿ‘‰ $ ./${pathRelative(reactProjectDirPath, pathJoin(keycloakThemeBuildingDirPath, containerLaunchScriptBasename))} ๐Ÿ‘ˆ`, "", - 'To enable the theme within keycloak log into the admin console ( ๐Ÿ‘‰ http://localhost:8080 username: admin, password: admin ๐Ÿ‘ˆ), create a realm (called "myrealm" for example),', - `go to your realm settings, click on the theme tab then select ${themeName}.`, - `More details: https://www.keycloak.org/getting-started/getting-started-docker`, - "", - "Once your container is up and configured ๐Ÿ‘‰ http://localhost:8080/auth/realms/myrealm/account ๐Ÿ‘ˆ", + "To test your theme: ", + "- Log into the admin console ๐Ÿ‘‰ http://localhost:8080 username: admin, password: admin ๐Ÿ‘ˆ", + '- Create a realm named "myrealm"', + '- Create a client with id "myclient" and root url: "https://www.keycloak.org/app/"', + `- Select Login Theme: ${themeName} (don't forget to save at the bottom of the page)`, + `- Go to ๐Ÿ‘‰ https://www.keycloak.org/app/ ๐Ÿ‘ˆ Click "Save" then "Sign in"`, + `You should see your login page, More details: https://www.keycloak.org/getting-started/getting-started-docker`, "", ].join("\n"), ); From 0d8dcf4829eba43895e1b4c0e84bd0a359d01966 Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 14:12:51 +0100 Subject: [PATCH 08/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8d2c78e0..5568176e 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.11", + "version": "4.2.12", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From 34314aa4ca70dbad2cb90b2319ff7497d26f40e5 Mon Sep 17 00:00:00 2001 From: actions Date: Wed, 8 Dec 2021 13:21:26 +0000 Subject: [PATCH 09/72] Update changelog v4.2.12 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79433426..a1c12d66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### **4.2.12** (2021-12-08) + +- Update post build instructions + ### **4.2.11** (2021-12-07) From 1cc1fd0a5a38ab9d845b39bc6d46ec13c2ab882a Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 15:28:26 +0100 Subject: [PATCH 10/72] Add a video to show how to test the theme in a local container --- src/bin/build-keycloak-theme/build-keycloak-theme.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/build-keycloak-theme/build-keycloak-theme.ts b/src/bin/build-keycloak-theme/build-keycloak-theme.ts index 41cae1fe..f32ae600 100644 --- a/src/bin/build-keycloak-theme/build-keycloak-theme.ts +++ b/src/bin/build-keycloak-theme/build-keycloak-theme.ts @@ -121,13 +121,14 @@ export function main() { "", `๐Ÿ‘‰ $ ./${pathRelative(reactProjectDirPath, pathJoin(keycloakThemeBuildingDirPath, containerLaunchScriptBasename))} ๐Ÿ‘ˆ`, "", - "To test your theme: ", + "Once your container is up and running: ", "- Log into the admin console ๐Ÿ‘‰ http://localhost:8080 username: admin, password: admin ๐Ÿ‘ˆ", '- Create a realm named "myrealm"', '- Create a client with id "myclient" and root url: "https://www.keycloak.org/app/"', `- Select Login Theme: ${themeName} (don't forget to save at the bottom of the page)`, - `- Go to ๐Ÿ‘‰ https://www.keycloak.org/app/ ๐Ÿ‘ˆ Click "Save" then "Sign in"`, - `You should see your login page, More details: https://www.keycloak.org/getting-started/getting-started-docker`, + `- Go to ๐Ÿ‘‰ https://www.keycloak.org/app/ ๐Ÿ‘ˆ Click "Save" then "Sign in". You should see your login page`, + "", + "Video demoing this process: https://youtu.be/N3wlBoH4hKg", "", ].join("\n"), ); From ac8503f8c89bd48a855f6e6374856a6c1a1eba84 Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 15:32:12 +0100 Subject: [PATCH 11/72] Add video to show how to get the template to load faster in developpement (changelog ignore) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bcb1fa35..9a03bfc4 100644 --- a/README.md +++ b/README.md @@ -466,10 +466,10 @@ It's all-right because every statement that can fail is inside an `<#attempt><#r The problem of templates taking a long time to load only happens in the test environment, when you have a console logging all the above-mentioned `.ftl` warnings in real time. Logging all those warnings is what takes time. Once in production page load is way faster. -If you run the docker container locally we aknowelage that the loading time is getting out of hand. +If you run the docker container locally we acknowledge that the loading time is getting out of hand. We are [in the process](https://github.com/InseeFrLab/keycloakify/pull/63) of resolving this issue. -In the meantime we recommend to run the docker container as a background task. +In the meantime we recommend [to run the docker container as a background task](https://youtu.be/F29Z1GaH-jk). # Adding custom message (to `i18n/useKcMessage.tsx`) From 443081cc283ded9270b9ce96fb80bdfd7e853004 Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 15:40:11 +0100 Subject: [PATCH 12/72] Fix broken link about how to import fonts #62 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a03bfc4..3c8025ee 100644 --- a/README.md +++ b/README.md @@ -374,7 +374,8 @@ this limitation doesn't apply, you can import fonts however you see fit. - If it is possible, use Google Fonts or any other font provider. - If you want to host your font recommended approach is to move your fonts into the `public` directory and to place your `@font-face` statements in the `public/index.html`. - Example [here](https://github.com/InseeFrLab/onyxia-ui/blob/0e3a04610cfe872ca71dad59e05ced8f785dee4b/public/index.html#L6-L51). + Example [here](https://github.com/garronej/keycloakify-demo-app/blob/9aa2dbaec28a7786d6b2983c9a59d393dec1b2d6/public/index.html#L27-L73) + (and the font are [here](https://github.com/garronej/keycloakify-demo-app/tree/main/public/fonts/WorkSans)). - You can also [use non relative url](https://github.com/garronej/keycloakify-demo-app/blob/2de8a9eb6f5de9c94f9cd3991faad0377e63268c/src/fonts.scss#L16) but don't forget [`Access-Control-Allow-Origin`](https://github.com/garronej/keycloakify-demo-app/blob/2de8a9eb6f5de9c94f9cd3991faad0377e63268c/nginx.conf#L17-L19). # Implement context persistence (optional) From 5a5337dc6397ec881b3d97e35177d4f1fbee8340 Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Dec 2021 15:40:46 +0100 Subject: [PATCH 13/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5568176e..bc442f2a 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.12", + "version": "4.2.13", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From d36ea9539aa56aaec9d6091651450c03b641efff Mon Sep 17 00:00:00 2001 From: actions Date: Wed, 8 Dec 2021 14:54:09 +0000 Subject: [PATCH 14/72] Update changelog v4.2.13 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1c12d66..5fc1a127 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### **4.2.13** (2021-12-08) + +- Fix broken link about how to import fonts #62 +- Add a video to show how to test the theme in a local container + ### **4.2.12** (2021-12-08) - Update post build instructions From 457421b8d6cef8da5cdeddde039dbbcb0bde7b0f Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 9 Dec 2021 01:42:43 +0100 Subject: [PATCH 15/72] Update CI workflow (changelog ignore) --- .github/workflows/ci.yaml | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 368bd3cc..ed58c636 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,18 +22,18 @@ jobs: PACKAGE_MANAGER=yarn fi $PACKAGE_MANAGER run format:check - test: runs-on: macos-10.15 needs: test_formatting strategy: matrix: node: [ '15', '14', '13' ] + os: [ windows-latest, ubuntu-latest ] name: Test with Node v${{ matrix.node }} steps: - name: Tell if project is using npm or yarn id: step1 - uses: garronej/github_actions_toolkit@v2.2 + uses: garronej/ts-ci@v1.1.3 with: action_name: tell_if_project_uses_npm_or_yarn - uses: actions/checkout@v2.3.4 @@ -51,28 +51,35 @@ jobs: npm test check_if_version_upgraded: name: Check if version upgrade - if: github.event_name == 'push' + # We run this only if it's a push on the default branch or if it's a PR from a + # branch (meaning not a PR from a fork). It would be more straightforward to test if secrets.NPM_TOKEN is + # defined but GitHub Action don't allow it yet. + if: | + github.event_name == 'push' || + github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login runs-on: ubuntu-latest needs: test outputs: from_version: ${{ steps.step1.outputs.from_version }} to_version: ${{ steps.step1.outputs.to_version }} - is_upgraded_version: ${{steps.step1.outputs.is_upgraded_version }} + is_upgraded_version: ${{ steps.step1.outputs.is_upgraded_version }} + is_release_beta: ${{steps.step1.outputs.is_release_beta }} steps: - - uses: garronej/github_actions_toolkit@v2.2 + - uses: garronej/ts-ci@v1.1.3 id: step1 with: action_name: is_package_json_version_upgraded + branch: ${{ github.head_ref || github.ref }} update_changelog: runs-on: ubuntu-latest needs: check_if_version_upgraded if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' steps: - - uses: garronej/github_actions_toolkit@v2.4 + - uses: garronej/ts-ci@v1.1.3 with: action_name: update_changelog - branch: ${{ github.ref }} + branch: ${{ github.head_ref || github.ref }} create_github_release: runs-on: ubuntu-latest @@ -80,9 +87,6 @@ jobs: - update_changelog - check_if_version_upgraded steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - name: Build GitHub release body id: step1 run: | @@ -98,10 +102,10 @@ jobs: with: name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }} tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }} - target_commitish: ${{ github.ref }} + target_commitish: ${{ github.head_ref || github.ref }} body: ${{ steps.step1.outputs.body }} draft: false - prerelease: false + prerelease: ${{ needs.check_if_version_upgraded.outputs.is_release_beta == 'true' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -138,7 +142,12 @@ jobs: echo "Can't publish on NPM, You must first create a secret called NPM_TOKEN that contains your NPM auth token. https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets" false fi - npm publish + EXTRA_ARGS="" + if [ "$IS_BETA" = "true" ]; then + EXTRA_ARGS="--tag beta" + fi + npm publish $EXTRA_ARGS env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} \ No newline at end of file + VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} + IS_BETA: ${{ needs.check_if_version_upgraded.outputs.is_release_beta }} \ No newline at end of file From 5c46ecc0ed1f7f2db9d42fcec1c7daa69dd2dfac Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 9 Dec 2021 01:57:03 +0100 Subject: [PATCH 16/72] Update CI workflow (changelog ignore) --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ed58c636..4435b228 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,6 @@ jobs: strategy: matrix: node: [ '15', '14', '13' ] - os: [ windows-latest, ubuntu-latest ] name: Test with Node v${{ matrix.node }} steps: - name: Tell if project is using npm or yarn @@ -150,4 +149,4 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} - IS_BETA: ${{ needs.check_if_version_upgraded.outputs.is_release_beta }} \ No newline at end of file + IS_BETA: ${{ needs.check_if_version_upgraded.outputs.is_release_beta }} From 99a5efe36c3a78b5c00f955dbe89101ce89da501 Mon Sep 17 00:00:00 2001 From: Hongquan Zou Date: Thu, 9 Dec 2021 19:07:07 +0800 Subject: [PATCH 17/72] Add missing collon in README sample code Add miss ',' --- README.md | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3c8025ee..ab4712ff 100644 --- a/README.md +++ b/README.md @@ -152,27 +152,23 @@ your index should look something like: `src/index.tsx` ```tsx -import {ย App } from ".//App"; -import { - KcApp, - defaultKcProps, - getKcContext -} from "keycloakify"; -import {ย css }ย from "tss-react/@emotion/css"; +import { App } from ".//App"; +import { KcApp, defaultKcProps, getKcContext } from "keycloakify"; +import { css } from "tss-react/@emotion/css"; const { kcContext } = getKcContext(); const myClassName = css({ "color": "red" }); reactDom.render( - - document.getElementById("root") + , + document.getElementById("root"), ); ``` From 96d31e07c376318a93f2ebf702c4c3197c5d6249 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sat, 11 Dec 2021 20:26:37 +0100 Subject: [PATCH 18/72] Update about future fixes (changelog ignore) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ab4712ff..2ff9513c 100644 --- a/README.md +++ b/README.md @@ -76,8 +76,8 @@ If you already have a Keycloak custom theme, it can be easily ported to Keycloak - [Possible workarounds](#possible-workarounds) - [Implement context persistence (optional)](#implement-context-persistence-optional) - [Kickstart video](#kickstart-video) -- [About the errors related to `objectToJson` in Keycloak logs.](#about-the-errors-related-to-objecttojson-in-keycloak-logs) -- [The pages take too long to load ?](#the-pages-take-too-long-to-load-) +- [About the errors related to `objectToJson` in Keycloak logs. (problem soon to be fixed)](#about-the-errors-related-to-objecttojson-in-keycloak-logs) +- [The pages take too long to load ? (soon to be fixed too)](#the-pages-take-too-long-to-load-) - [Adding custom message (to `i18n/useKcMessage.tsx`)](#adding-custom-message-to-i18nusekcmessagetsx) - [Email domain whitelist](#email-domain-whitelist) - [Changelog highlights](#changelog-highlights) From 5f07cb374bc303fb1bb98dab207acb27d80c29c3 Mon Sep 17 00:00:00 2001 From: actions Date: Wed, 8 Dec 2021 14:54:09 +0000 Subject: [PATCH 19/72] Update changelog v4.2.13 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1c12d66..5fc1a127 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### **4.2.13** (2021-12-08) + +- Fix broken link about how to import fonts #62 +- Add a video to show how to test the theme in a local container + ### **4.2.12** (2021-12-08) - Update post build instructions From f316f38ae5bf74f1673b952d2d60be54e19318f2 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 9 Dec 2021 01:57:03 +0100 Subject: [PATCH 20/72] Update CI workflow (changelog ignore) --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ed58c636..4435b228 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,6 @@ jobs: strategy: matrix: node: [ '15', '14', '13' ] - os: [ windows-latest, ubuntu-latest ] name: Test with Node v${{ matrix.node }} steps: - name: Tell if project is using npm or yarn @@ -150,4 +149,4 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} - IS_BETA: ${{ needs.check_if_version_upgraded.outputs.is_release_beta }} \ No newline at end of file + IS_BETA: ${{ needs.check_if_version_upgraded.outputs.is_release_beta }} From cb18d3d7654f482c326f66757725c5db5de7ed16 Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 9 Dec 2021 02:00:50 +0100 Subject: [PATCH 21/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc442f2a..9dbe76f0 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.13", + "version": "4.2.14-beta.0", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From 6e0553af9bbc0487cf280c9ff8e54649930c5aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=81=D1=82=D1=80=D0=BE=D0=B2=D0=B0=20=D0=90?= =?UTF-8?q?=D0=BD=D0=BD=D0=B0?= Date: Wed, 8 Dec 2021 10:30:36 +0300 Subject: [PATCH 22/72] Avoid error in Keycloak logs, fix long template loading time --- .gitignore | 2 + .../generateFtl/Object.deepAssign.js | 28 --- .../generateFtl/common.ftl | 208 ---------------- ..._object_to_js_code_declaring_an_object.ftl | 230 ++++++++++++++++++ .../generateFtl/generateFtl.ts | 43 ++-- 5 files changed, 246 insertions(+), 265 deletions(-) delete mode 100644 src/bin/build-keycloak-theme/generateFtl/Object.deepAssign.js delete mode 100644 src/bin/build-keycloak-theme/generateFtl/common.ftl create mode 100644 src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl diff --git a/.gitignore b/.gitignore index 6ab01048..57451200 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ jspm_packages /sample_react_project/ /.yarn_home/ + +.idea diff --git a/src/bin/build-keycloak-theme/generateFtl/Object.deepAssign.js b/src/bin/build-keycloak-theme/generateFtl/Object.deepAssign.js deleted file mode 100644 index 028d9990..00000000 --- a/src/bin/build-keycloak-theme/generateFtl/Object.deepAssign.js +++ /dev/null @@ -1,28 +0,0 @@ - -Object.defineProperty( - Object, - "deepAssign", - { - "value": function callee(target, source) { - Object.keys(source).forEach(function (key) { - var value = source[key]; - if (target[key] === undefined) { - target[key] = value; - return; - } - if (value instanceof Object) { - if (value instanceof Array) { - value.forEach(function (entry) { - target[key].push(entry); - }); - return; - } - callee(target[key], value); - return; - } - target[key] = value; - }); - return target; - } - } -); \ No newline at end of file diff --git a/src/bin/build-keycloak-theme/generateFtl/common.ftl b/src/bin/build-keycloak-theme/generateFtl/common.ftl deleted file mode 100644 index 5323e896..00000000 --- a/src/bin/build-keycloak-theme/generateFtl/common.ftl +++ /dev/null @@ -1,208 +0,0 @@ - \ No newline at end of file diff --git a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl new file mode 100644 index 00000000..183d3b95 --- /dev/null +++ b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl @@ -0,0 +1,230 @@ + \ No newline at end of file diff --git a/src/bin/build-keycloak-theme/generateFtl/generateFtl.ts b/src/bin/build-keycloak-theme/generateFtl/generateFtl.ts index ab417140..89e63fa8 100644 --- a/src/bin/build-keycloak-theme/generateFtl/generateFtl.ts +++ b/src/bin/build-keycloak-theme/generateFtl/generateFtl.ts @@ -21,10 +21,6 @@ export const pageIds = [ export type PageId = typeof pageIds[number]; -function loadAdjacentFile(fileBasename: string) { - return fs.readFileSync(pathJoin(__dirname, fileBasename)).toString("utf8"); -} - export function generateFtlFilesCodeFactory(params: { cssGlobalsToDefine: Record; indexHtmlCode: string; @@ -77,8 +73,11 @@ export function generateFtlFilesCodeFactory(params: { ); //FTL is no valid html, we can't insert with cheerio, we put placeholder for injecting later. - const ftlPlaceholders = { - '{ "x": "vIdLqMeOed9sdLdIdOxdK0d" }': loadAdjacentFile("common.ftl").match(/^", - "", "", - pageSpecificCodePlaceholder, - "", - objectKeys(ftlPlaceholders)[1], + objectKeys(replaceValueBySearchValue)[1], ].join("\n"), ); @@ -129,19 +121,12 @@ export function generateFtlFilesCodeFactory(params: { const $ = cheerio.load(partiallyFixedIndexHtmlCode); - let ftlCode = $.html().replace( - pageSpecificCodePlaceholder, - [ - "", - ].join("\n"), - ); + let ftlCode = $.html(); - objectKeys(ftlPlaceholders).forEach(id => (ftlCode = ftlCode.replace(id, ftlPlaceholders[id]))); + Object.entries({ + ...replaceValueBySearchValue, + [pageIdSearchValue]: pageId, + }).map(([searchValue, replaceValue]) => (ftlCode = ftlCode.replace(searchValue, replaceValue))); return { ftlCode }; } From 484f95f5d2bea5fd756d1698d4aa0bcf0eb4adf4 Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 12:53:11 +0100 Subject: [PATCH 23/72] Bump beta version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9dbe76f0..3b59dcfd 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.14-beta.0", + "version": "4.2.14-beta.1", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From d70985d8d2109afa794d62c35d862c57b3d094e8 Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 14:10:00 +0100 Subject: [PATCH 24/72] Update README, remove all instruction about errors in logs --- README.md | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 3c8025ee..4cbb5483 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,10 @@

-**NEW in v4** +**NEW in 4.2.14** -- Out of the box [frontend form validation](#user-profile-and-frontend-form-validation) ๐Ÿฅณ -- Improvements (and breaking changes in `import { useKcMessage } from "keycloakify"`. +- No more error in Keycloak logs ๐Ÿพ +- Templates now load in fraction of a second ๐ŸŽ # Motivations @@ -76,8 +76,6 @@ If you already have a Keycloak custom theme, it can be easily ported to Keycloak - [Possible workarounds](#possible-workarounds) - [Implement context persistence (optional)](#implement-context-persistence-optional) - [Kickstart video](#kickstart-video) -- [About the errors related to `objectToJson` in Keycloak logs.](#about-the-errors-related-to-objecttojson-in-keycloak-logs) -- [The pages take too long to load ?](#the-pages-take-too-long-to-load-) - [Adding custom message (to `i18n/useKcMessage.tsx`)](#adding-custom-message-to-i18nusekcmessagetsx) - [Email domain whitelist](#email-domain-whitelist) - [Changelog highlights](#changelog-highlights) @@ -442,36 +440,6 @@ flash of the blank html before the js bundle have been evaluated _NOTE: keycloak-react-theming was renamed keycloakify since this video was recorded_ [![kickstart_video](https://user-images.githubusercontent.com/6702424/108877866-f146ee80-75ff-11eb-8120-003b3c5f6dd8.png)](https://youtu.be/xTz0Rj7i2v8) -# About the errors related to `objectToJson` in Keycloak logs. - -The logs of your keycloak server will always show this kind of errors every time a client request a page: - -```log -FTL stack trace ("~" means nesting-related): - - Failed at: #local value = object[key] [in template "login.ftl" in macro "objectToJson_please_ignore_errors" at line 70, column 21] - - Reached through: @compress [in template "login.ftl" in macro "objectToJson_please_ignore_errors" at line 36, column 5] - - Reached through: @objectToJson_please_ignore_errors object=value depth=(dep... [in template "login.ftl" in macro "objectToJson_please_ignore_errors" at line 81, column 27] - - Reached through: @compress [in template "login.ftl" in macro "objectToJson_please_ignore_errors" at line 36, column 5] - - Reached through: @objectToJson_please_ignore_errors object=(.data_model) de... [in template "login.ftl" at line 163, column 43] -``` - -Theses are expected to show up in the log. -Unfortunately, there is nothing I know of that can be done to avoid them or even mute them. -They can be, however, safely ignored. - -To [converts the `.ftl` values into a JavaScript object](https://github.com/InseeFrLab/keycloakify/blob/main/src/bin/build-keycloak-theme/generateFtl/common.ftl) -without making assumptions on the `.data_model` we have to do things that throws. -It's all-right because every statement that can fail is inside an `<#attempt><#recorver>` block but it results in errors being printed to the logs. - -# The pages take too long to load ? - -The problem of templates taking a long time to load only happens in the test environment, when you have a console logging all the above-mentioned `.ftl` warnings in real time. Logging all those warnings is what takes time. Once in production page load is way faster. - -If you run the docker container locally we acknowledge that the loading time is getting out of hand. -We are [in the process](https://github.com/InseeFrLab/keycloakify/pull/63) of resolving this issue. - -In the meantime we recommend [to run the docker container as a background task](https://youtu.be/F29Z1GaH-jk). - # Adding custom message (to `i18n/useKcMessage.tsx`) You can reproduce [this approach](https://github.com/garronej/keycloakify-demo-app/blob/main/src/kcMessagesExtension.ts) From 159429da6e3f0043943a99b00268ffb782439dd1 Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 17:39:39 +0100 Subject: [PATCH 25/72] Remove extra semicollon in ftl (changelog ignore) --- .../generateFtl/ftl_object_to_js_code_declaring_an_object.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl index 183d3b95..814ba0da 100644 --- a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +++ b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl @@ -78,7 +78,7 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc}; return out; -})(); +})() <#function ftl_object_to_js_code_declaring_an_object object path> <#local isHash = ""> From cee9569581e4232e3d63a3cf7c1c57ad8139f0e7 Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 18:59:39 +0100 Subject: [PATCH 26/72] Refactor: Create ftl function are_same_path (changelog ignore) --- ..._object_to_js_code_declaring_an_object.ftl | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl index 814ba0da..730c4d43 100644 --- a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +++ b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl @@ -113,7 +113,7 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc}; <#if ["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key) && - path?map(x -> x?is_number?string("_index_",x))?join("ยฐ") == ["url"]?join("ยฐ") + are_same_path(path, ["url"]) > <#local out_seq += ["/*If you need" + key + " please submit an issue to the Keycloakify repo*/"]> <#continue> @@ -226,5 +226,40 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc}; <#return "ABORT: Couldn't convert into string non hash, non method, non boolean, non enumerable object"> + +<#function are_same_path path searchedPath> + + <#if path?size != path?size> + <#return false> + + + <#local i=0> + + <#list path as property> + + <#local searchedProperty=searchedPath[i]> + + <#if searchedProperty?is_string && searchedProperty == "*"> + <#continue> + + + <#if searchedProperty?is_string && !property?is_string> + <#return false> + + + <#if searchedProperty?is_number && !property?is_number> + <#return false> + + + <#if searchedProperty?string != property?string> + <#return false> + + + <#local i+= 1> + + + + <#return true> + \ No newline at end of file From 57a5d034ddd770e3e81fa8b81bf8054bfaed55d2 Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 19:06:12 +0100 Subject: [PATCH 27/72] Fix ftl error as comment formatting --- .../generateFtl/ftl_object_to_js_code_declaring_an_object.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl index 730c4d43..8522aaea 100644 --- a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +++ b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl @@ -115,7 +115,7 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc}; ["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key) && are_same_path(path, ["url"]) > - <#local out_seq += ["/*If you need" + key + " please submit an issue to the Keycloakify repo*/"]> + <#local out_seq += ["/*If you need '" + key + "' please submit an issue to the Keycloakify repo*/"]> <#continue> From b3892dab8d4908bdd58b530387395bf090652f7b Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 19:19:17 +0100 Subject: [PATCH 28/72] Ftl prevent error with auth.attemptedUsername --- .../ftl_object_to_js_code_declaring_an_object.ftl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl index 8522aaea..c2cb7df2 100644 --- a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +++ b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl @@ -119,6 +119,18 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc}; <#continue> + <#if key == "attemptedUsername" && are_same_path(path, ["auth"])> + + <#attempt> + <#-- https://github.com/keycloak/keycloak/blob/3a2bf0c04bcde185e497aaa32d0bb7ab7520cf4a/themes/src/main/resources/theme/base/login/template.ftl#L63 --> + <#if !(auth?has_content && auth.showUsername() && !auth.showResetCredentials())> + <#continue> + + <#recover> + + + + <#attempt> <#if !object[key]??> <#continue> From 86ab9f72a5f572a30937a0a1a3667807c74e1aa9 Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 19:34:50 +0100 Subject: [PATCH 29/72] Ftl prevent error with updateProfileCtx --- .../ftl_object_to_js_code_declaring_an_object.ftl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl index c2cb7df2..0e138985 100644 --- a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +++ b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl @@ -111,9 +111,15 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc}; <#continue> + <#-- Skip values that are known to throw sometime and that are used nowhere in the base Keycloak template --> <#if - ["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key) && - are_same_path(path, ["url"]) + ( + ["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key) && + are_same_path(path, ["url"]) + ) || ( + key == "updateProfileCtx" && + are_same_path(path, []) + ) > <#local out_seq += ["/*If you need '" + key + "' please submit an issue to the Keycloakify repo*/"]> <#continue> From a8623d80661e5f5163f10536c4b73e6686bb5ecd Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 20:17:50 +0100 Subject: [PATCH 30/72] Fix ftl error related to url.loginAction in saml-post-form.ftl --- .../ftl_object_to_js_code_declaring_an_object.ftl | 11 +++++++++-- .../build-keycloak-theme/generateFtl/generateFtl.ts | 6 ++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl index 0e138985..b1e6627d 100644 --- a/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +++ b/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl @@ -1,4 +1,5 @@ ", "", objectKeys(replaceValueBySearchValue)[1], @@ -125,7 +122,8 @@ export function generateFtlFilesCodeFactory(params: { Object.entries({ ...replaceValueBySearchValue, - [pageIdSearchValue]: pageId, + //If updated, don't forget to change in the ftl script as well. + "PAGE_ID_xIgLsPgGId9D8e": pageId, }).map(([searchValue, replaceValue]) => (ftlCode = ftlCode.replace(searchValue, replaceValue))); return { ftlCode }; From 26b80d6af71695162767d7943fbfe92aefa92f40 Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 20:44:03 +0100 Subject: [PATCH 31/72] Encourage users to report errors in logs --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 55498c7b..1989dc3f 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ If you already have a Keycloak custom theme, it can be easily ported to Keycloak - [Possible workarounds](#possible-workarounds) - [Implement context persistence (optional)](#implement-context-persistence-optional) - [Kickstart video](#kickstart-video) +- [FTL errors related to `ftl_object_to_js_code_declaring_an_object` in Keycloak logs.](#ftl-errors-related-to-ftl_object_to_js_code_declaring_an_object-in-keycloak-logs) - [Adding custom message (to `i18n/useKcMessage.tsx`)](#adding-custom-message-to-i18nusekcmessagetsx) - [Email domain whitelist](#email-domain-whitelist) - [Changelog highlights](#changelog-highlights) @@ -436,6 +437,23 @@ flash of the blank html before the js bundle have been evaluated _NOTE: keycloak-react-theming was renamed keycloakify since this video was recorded_ [![kickstart_video](https://user-images.githubusercontent.com/6702424/108877866-f146ee80-75ff-11eb-8120-003b3c5f6dd8.png)](https://youtu.be/xTz0Rj7i2v8) +# FTL errors related to `ftl_object_to_js_code_declaring_an_object` in Keycloak logs. + +If you ever encounter one of these errors: + +```log +FTL stack trace ("~" means nesting-related): + - Failed at: #local value = object[key] [in template "login.ftl" in macro "ftl_object_to_js_code_declaring_an_object" at line 70, column 21] + - Reached through: @compress [in template "login.ftl" in macro "ftl_object_to_js_code_declaring_an_object" at line 36, column 5] + - Reached through: @ftl_object_to_js_code_declaring_an_object object=value depth=(dep... [in template "login.ftl" in macro "ftl_object_to_js_code_declaring_an_object" at line 81, column 27] + - Reached through: @compress [in template "login.ftl" in macro "ftl_object_to_js_code_declaring_an_object" at line 36, column 5] + - Reached through: @ftl_object_to_js_code_declaring_an_object object=(.data_model) de... [in template "login.ftl" at line 163, column 43] +``` + +It's just noise, they can be safely ignored. +You can, however, and are encouraged to, report any that you would spot. +Just open an issue about it and I will release a patched version of Keycloakify in the better delays. + # Adding custom message (to `i18n/useKcMessage.tsx`) You can reproduce [this approach](https://github.com/garronej/keycloakify-demo-app/blob/main/src/kcMessagesExtension.ts) From 785ce7a8abf2b0ca7a17d38b1b688a8beb6d662c Mon Sep 17 00:00:00 2001 From: garronej Date: Sun, 12 Dec 2021 20:46:58 +0100 Subject: [PATCH 32/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3b59dcfd..fe9d259c 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.14-beta.1", + "version": "4.2.14", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From cfcc48259c5fd9dc41e3a833c7fd3b661e6a23e7 Mon Sep 17 00:00:00 2001 From: actions Date: Sun, 12 Dec 2021 19:49:27 +0000 Subject: [PATCH 33/72] Update changelog v4.2.14 --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fc1a127..39d3271f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +### **4.2.14** (2021-12-12) + +- Merge pull request #65 from InseeFrLab/doge_ftl_errors + +Prevent ftl errors in Keycloak log +- Encourage users to report errors in logs +- Fix ftl error related to url.loginAction in saml-post-form.ftl +- Ftl prevent error with updateProfileCtx +- Ftl prevent error with auth.attemptedUsername +- Fix ftl error as comment formatting +- Merge remote-tracking branch 'origin/main' into doge_ftl_errors +- Update README, remove all instruction about errors in logs +- Avoid error in Keycloak logs, fix long template loading time +- Add missing collon in README sample code + +Add miss ',' + ### **4.2.13** (2021-12-08) - Fix broken link about how to import fonts #62 From 46bd319ebefe44636c692dd0af4321ca17d34964 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sun, 12 Dec 2021 21:41:23 +0100 Subject: [PATCH 34/72] Fix small error in readme (changelog ignore) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1989dc3f..0ebc8e2c 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ For more information see [this issue](https://github.com/InseeFrLab/keycloakify/ **All this is defaults with [`create-react-app`](https://create-react-app.dev)** (tested with 4.0.3) - `mvn` ([Maven](https://maven.apache.org/)), `rm`, `mkdir`, `curl`, `unzip` are assumed to be available. -- `docker` must be up and running when running `yarn keycloak`. +- `docker` must be up and running when running `start_keycloak_testing_container.sh` (Instructions provided after running `yarn keycloak`). ## My framework doesnโ€™t seem to be supported, what can I do? From 1138313028ebe7ac58aac20ddd080137492a50f4 Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 16 Dec 2021 20:44:39 +0100 Subject: [PATCH 35/72] use custom polyfill for path.join (fix webpack 5 build) --- src/lib/components/LoginOtp.tsx | 2 +- src/lib/getKcContext/kcContextMocks/kcContextMocks.ts | 2 +- src/lib/getKcContext/kcContextMocks/urlResourcesPath.ts | 6 +++--- src/lib/tools/pathJoin.ts | 3 +++ 4 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 src/lib/tools/pathJoin.ts diff --git a/src/lib/components/LoginOtp.tsx b/src/lib/components/LoginOtp.tsx index f09df5da..2406aef6 100644 --- a/src/lib/components/LoginOtp.tsx +++ b/src/lib/components/LoginOtp.tsx @@ -4,7 +4,7 @@ import type { KcProps } from "./KcProps"; import type { KcContextBase } from "../getKcContext/KcContextBase"; import { useKcMessage } from "../i18n/useKcMessage"; import { headInsert } from "../tools/headInsert"; -import { join as pathJoin } from "path"; +import { pathJoin } from "../tools/pathJoin"; import { useCssAndCx } from "tss-react"; export const LoginOtp = memo(({ kcContext, ...props }: { kcContext: KcContextBase.LoginOtp } & KcProps) => { diff --git a/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts b/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts index 076d2e65..dd399564 100644 --- a/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts +++ b/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts @@ -5,7 +5,7 @@ import { getKcLanguageTagLabel } from "../../i18n/KcLanguageTag"; //NOTE: Aside because we want to be able to import them from node import { resourcesCommonPath, resourcesPath } from "./urlResourcesPath"; import { id } from "tsafe/id"; -import { join as pathJoin } from "path"; +import { pathJoin } from "../../tools/pathJoin"; const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/"; diff --git a/src/lib/getKcContext/kcContextMocks/urlResourcesPath.ts b/src/lib/getKcContext/kcContextMocks/urlResourcesPath.ts index 47d7a7f2..542126dd 100644 --- a/src/lib/getKcContext/kcContextMocks/urlResourcesPath.ts +++ b/src/lib/getKcContext/kcContextMocks/urlResourcesPath.ts @@ -1,5 +1,5 @@ -import { join as pathJoin } from "path"; +import { pathJoin } from "../../tools/pathJoin"; export const subDirOfPublicDirBasename = "keycloak_static"; -export const resourcesPath = pathJoin(subDirOfPublicDirBasename, "/resources"); -export const resourcesCommonPath = pathJoin(subDirOfPublicDirBasename, "/resources_common"); +export const resourcesPath = pathJoin(subDirOfPublicDirBasename, "resources"); +export const resourcesCommonPath = pathJoin(subDirOfPublicDirBasename, "resources_common"); diff --git a/src/lib/tools/pathJoin.ts b/src/lib/tools/pathJoin.ts new file mode 100644 index 00000000..f3dff1b4 --- /dev/null +++ b/src/lib/tools/pathJoin.ts @@ -0,0 +1,3 @@ +export function pathJoin(...path: string[]): string { + return path.map(part => part.replace(/^\/+/, "").replace(/\/+$/, "")).join("/"); +} From 71847735219cd0230d4bfa4a7929875972242b86 Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 16 Dec 2021 20:45:04 +0100 Subject: [PATCH 36/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fe9d259c..63f82e5d 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.14", + "version": "4.2.15", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From 128c416ce72a4651fa9c6f37ba6f1b0b90785dee Mon Sep 17 00:00:00 2001 From: actions Date: Thu, 16 Dec 2021 19:48:20 +0000 Subject: [PATCH 37/72] Update changelog v4.2.15 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39d3271f..f7ff1a94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### **4.2.15** (2021-12-16) + +- use custom polyfill for path.join (fix webpack 5 build) + ### **4.2.14** (2021-12-12) - Merge pull request #65 from InseeFrLab/doge_ftl_errors From a2bd5050ffcf6d3e8d571cb7d88e55a2094018e2 Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 16 Dec 2021 20:54:13 +0100 Subject: [PATCH 38/72] add missing reference to path in src/lib (changelog ignore) --- src/lib/components/Template.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/Template.tsx b/src/lib/components/Template.tsx index 61ca2a63..a9171e61 100644 --- a/src/lib/components/Template.tsx +++ b/src/lib/components/Template.tsx @@ -9,7 +9,7 @@ import { getBestMatchAmongKcLanguageTag } from "../i18n/KcLanguageTag"; import { getKcLanguageTagLabel } from "../i18n/KcLanguageTag"; import { useCallbackFactory } from "powerhooks/useCallbackFactory"; import { headInsert } from "../tools/headInsert"; -import { join as pathJoin } from "path"; +import { pathJoin } from "../tools/pathJoin"; import { useConstCallback } from "powerhooks/useConstCallback"; import type { KcTemplateProps } from "./KcProps"; import { useCssAndCx } from "tss-react"; From 51129aaeffae9361c6c456a4f87f822151991f7a Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 16 Dec 2021 20:56:41 +0100 Subject: [PATCH 39/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 63f82e5d..efa8edbf 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.15", + "version": "4.2.16", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From 57134359b984b26864180870d9f43bbdcdb37523 Mon Sep 17 00:00:00 2001 From: actions Date: Thu, 16 Dec 2021 20:00:18 +0000 Subject: [PATCH 40/72] Update changelog v4.2.16 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7ff1a94..bd9822a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### **4.2.16** (2021-12-16) + + + ### **4.2.15** (2021-12-16) - use custom polyfill for path.join (fix webpack 5 build) From cb8b165c8e35859e97348e0d35e3578452bf073e Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 16 Dec 2021 23:13:18 +0100 Subject: [PATCH 41/72] Fix path.join polyfill --- src/lib/tools/pathJoin.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/tools/pathJoin.ts b/src/lib/tools/pathJoin.ts index f3dff1b4..fac076a5 100644 --- a/src/lib/tools/pathJoin.ts +++ b/src/lib/tools/pathJoin.ts @@ -1,3 +1,6 @@ export function pathJoin(...path: string[]): string { - return path.map(part => part.replace(/^\/+/, "").replace(/\/+$/, "")).join("/"); + return path + .map((part, i) => (i === 0 ? part : part.replace(/^\/+/, ""))) + .map((part, i) => (i === path.length - 1 ? part : part.replace(/\/+$/, ""))) + .join("/"); } From 633a32ffd6a41bccc834c3fcac680883d67d86ef Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 16 Dec 2021 23:13:41 +0100 Subject: [PATCH 42/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index efa8edbf..bd2171bc 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.16", + "version": "4.2.17", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From 32d0388556dad6439f8473d3e2127d84fd8aac3b Mon Sep 17 00:00:00 2001 From: actions Date: Thu, 16 Dec 2021 22:16:24 +0000 Subject: [PATCH 43/72] Update changelog v4.2.17 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd9822a6..32f79c76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### **4.2.17** (2021-12-16) + +- Fix path.join polyfill + ### **4.2.16** (2021-12-16) From 93bcdac3be418bf17b8df72ab7dccdf38c5e4fd8 Mon Sep 17 00:00:00 2001 From: garronej Date: Fri, 17 Dec 2021 00:00:01 +0100 Subject: [PATCH 44/72] Add notice about Webpack 5 (changelog ignore) --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 0ebc8e2c..e659fe8c 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@

+**NOTICE:** Fonts are not loaded properly in Webpack 5. Used in the very last version of `create-react-app`. +It will be fixed soon. + **NEW in 4.2.14** - No more error in Keycloak logs ๐Ÿพ From cb8a41d5be6080c378731f429fd64a02ede87824 Mon Sep 17 00:00:00 2001 From: garronej Date: Fri, 17 Dec 2021 19:30:44 +0100 Subject: [PATCH 45/72] Improve css url() import (fix CRA 5) --- README.md | 8 -------- src/bin/build-keycloak-theme/replaceImportFromStatic.ts | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e659fe8c..680d6060 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,6 @@

-**NOTICE:** Fonts are not loaded properly in Webpack 5. Used in the very last version of `create-react-app`. -It will be fixed soon. - -**NEW in 4.2.14** - -- No more error in Keycloak logs ๐Ÿพ -- Templates now load in fraction of a second ๐ŸŽ - # Motivations Keycloak provides [theme support](https://www.keycloak.org/docs/latest/server_development/#_themes) for web pages. This allows customizing the look and feel of end-user facing pages so they can be integrated with your applications. diff --git a/src/bin/build-keycloak-theme/replaceImportFromStatic.ts b/src/bin/build-keycloak-theme/replaceImportFromStatic.ts index 0d7d9be0..55b11ab3 100644 --- a/src/bin/build-keycloak-theme/replaceImportFromStatic.ts +++ b/src/bin/build-keycloak-theme/replaceImportFromStatic.ts @@ -37,7 +37,7 @@ export function replaceImportsInInlineCssCode(params: { cssCode: string; urlPath const { cssCode, urlPathname, urlOrigin } = params; const fixedCssCode = cssCode.replace( - urlPathname === "/" ? /url\(\/([^/][^)]+)\)/g : new RegExp(`url\\(${urlPathname}([^)]+)\\)`, "g"), + urlPathname === "/" ? /url\(["']?\/([^/][^)"']+)["']?\)/g : new RegExp(`url\\(["']?${urlPathname}([^)"']+)["']?\\)`, "g"), (...[, group]) => `url(${urlOrigin === undefined ? "${url.resourcesPath}/build/" + group : params.urlOrigin + urlPathname + group})`, ); @@ -52,7 +52,7 @@ export function replaceImportsInCssCode(params: { cssCode: string }): { const cssGlobalsToDefine: Record = {}; - new Set(cssCode.match(/url\(\/[^/][^)]+\)[^;}]*/g) ?? []).forEach( + new Set(cssCode.match(/url\(["']?\/[^/][^)"']+["']?\)[^;}]*/g) ?? []).forEach( match => (cssGlobalsToDefine["url" + crypto.createHash("sha256").update(match).digest("hex").substring(0, 15)] = match), ); From e8a3751b3240d50192c351c25cc6d9b20a715c19 Mon Sep 17 00:00:00 2001 From: garronej Date: Fri, 17 Dec 2021 19:31:11 +0100 Subject: [PATCH 46/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bd2171bc..71c305db 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.17", + "version": "4.2.18", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From 1d63c393a3c6f7ea841bb05b2793b878479abaa7 Mon Sep 17 00:00:00 2001 From: actions Date: Fri, 17 Dec 2021 18:38:15 +0000 Subject: [PATCH 47/72] Update changelog v4.2.18 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32f79c76..86a5542a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### **4.2.18** (2021-12-17) + +- Improve css url() import (fix CRA 5) + ### **4.2.17** (2021-12-16) - Fix path.join polyfill From daac05c1adc53336c68a25c9e29e0d590c4b3f85 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sat, 18 Dec 2021 18:13:58 +0100 Subject: [PATCH 48/72] Update confirmed working webpack version (changelog ignore) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 680d6060..87d7e053 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ Tested with the following Keycloak versions: This tool will be maintained to stay compatible with Keycloak v11 and up, however, the default pages you will get (before you customize it) will always be the ones of Keycloak v11. -This tool assumes you are bundling your app with Webpack (tested with 4.44.2) . +This tool assumes you are bundling your app with Webpack (tested with the versions that ships with CRA v4.44.2 and v5.0.0) . It assumes there is a `build/` directory at the root of your react project directory containing a `index.html` file and a `build/static/` directory generated by webpack. For more information see [this issue](https://github.com/InseeFrLab/keycloakify/issues/5#issuecomment-832296432) From 42cd0fe2f04d3ce15e68a6433e445c5536383742 Mon Sep 17 00:00:00 2001 From: Victor Bustamante Date: Tue, 21 Dec 2021 09:45:23 -0300 Subject: [PATCH 49/72] Adding name field to realm in KcContext type --- src/lib/getKcContext/KcContextBase.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/getKcContext/KcContextBase.ts b/src/lib/getKcContext/KcContextBase.ts index 49ea3e7b..5c116154 100644 --- a/src/lib/getKcContext/KcContextBase.ts +++ b/src/lib/getKcContext/KcContextBase.ts @@ -34,6 +34,7 @@ export declare namespace KcContextBase { loginUrl: string; }; realm: { + name: string; displayName?: string; displayNameHtml?: string; internationalizationEnabled: boolean; From e3e8fb663a90f00d34baf4814c76b4df50db912e Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Tue, 21 Dec 2021 14:39:58 +0100 Subject: [PATCH 50/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71c305db..099d51ff 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.18", + "version": "4.2.19", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From eedcd7a2a6b6eb1522cb7a3b94c3ca19a8c0ba92 Mon Sep 17 00:00:00 2001 From: Victor Bustamante Date: Tue, 21 Dec 2021 12:27:28 -0300 Subject: [PATCH 51/72] Added realm name field to KcContext mocks object --- src/lib/getKcContext/kcContextMocks/kcContextMocks.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts b/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts index dd399564..bd0d557c 100644 --- a/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts +++ b/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts @@ -18,6 +18,7 @@ export const kcContextCommonMock: KcContextBase.Common = { "loginUrl": "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg", }, "realm": { + "name": "myrealm", "displayName": "myrealm", "displayNameHtml": "myrealm", "internationalizationEnabled": true, From 6db11a7433c0c8b0ba2ecb94c121f6b4eaca953a Mon Sep 17 00:00:00 2001 From: actions Date: Tue, 21 Dec 2021 15:47:35 +0000 Subject: [PATCH 52/72] Update changelog v4.2.19 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86a5542a..c99aa238 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +### **4.2.19** (2021-12-21) + +- Merge pull request #70 from VBustamante/patch-1 +- Added realm name field to KcContext mocks object +- Merge pull request #69 from VBustamante/patch-1 + +Adding name field to realm in KcContext type +- Adding name field to realm in KcContext type + ### **4.2.18** (2021-12-17) - Improve css url() import (fix CRA 5) From 7137ff425732b8b7c53bca2f92848b6888a0d39d Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Tue, 21 Dec 2021 16:47:40 +0100 Subject: [PATCH 53/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 099d51ff..d0c8806e 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.19", + "version": "4.2.20", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From 729503fe31a155a823f46dd66ad4ff34ca274e0a Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 23 Dec 2021 12:28:45 +0100 Subject: [PATCH 54/72] Fix borken link to onyxia #71 (changelog ignore) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 87d7e053..39b0b658 100644 --- a/README.md +++ b/README.md @@ -203,8 +203,8 @@ reactDom.render(

-Example of a customization using only CSS: [here](https://github.com/InseeFrLab/onyxia-ui/blob/012639d62327a9a56be80c46e32c32c9497b82db/src/app/components/KcApp.tsx) -(the [index.tsx](https://github.com/InseeFrLab/onyxia-ui/blob/012639d62327a9a56be80c46e32c32c9497b82db/src/app/index.tsx#L89-L94) ) +Example of a customization using only CSS: [here](https://github.com/InseeFrLab/onyxia-web/blob/012639d62327a9a56be80c46e32c32c9497b82db/src/app/components/KcApp.tsx) +(the [index.tsx](https://github.com/InseeFrLab/onyxia-web/blob/012639d62327a9a56be80c46e32c32c9497b82db/src/app/index.tsx#L89-L94) ) and the result you can expect:

@@ -219,7 +219,7 @@ If you want to go beyond only customizing the CSS you can re-implement some of t pages or even add new ones. If you want to go this way checkout the demo setup provided [here](https://github.com/garronej/keycloakify-demo-app/tree/look_and_feel). -If you prefer a real life example you can checkout [onyxia-web's source](https://github.com/InseeFrLab/onyxia-web/tree/main/src/app/components/KcApp). +If you prefer a real life example you can checkout [onyxia-web's source](https://github.com/InseeFrLab/onyxia-web/tree/main/src/ui/components/KcApp). The web app is in production [here](https://datalab.sspcloud.fr). Main takeaways are: @@ -425,7 +425,7 @@ keycloakInstance.init({ If you really want to go the extra miles and avoid having the white flash of the blank html before the js bundle have been evaluated -[here is a snippet](https://github.com/InseeFrLab/onyxia-ui/blob/a77eb502870cfe6878edd0d956c646d28746d053/public/index.html#L5-L54) that you can place in your `public/index.html` if you are using `powerhooks/useGlobalState`. +[here is a snippet](https://github.com/InseeFrLab/onyxia-web/blob/e1c1f309aaa3d5f860df39ba0b75cce89c88a9de/public/index.html#L117-L166) that you can place in your `public/index.html` if you are using `powerhooks/useGlobalState`. # Kickstart video From a83eec31d812e94e8a8897ac2304905735b1ad6d Mon Sep 17 00:00:00 2001 From: garronej Date: Thu, 23 Dec 2021 14:01:52 +0100 Subject: [PATCH 55/72] Feat link behind badges (changelog ignore) --- README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 39b0b658..4c4bab3c 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,21 @@ ๐Ÿ” Create Keycloak themes using React ๐Ÿ”

- - - - - + + + + + + + + + + + + + + + From d05a62e1ea12c8f9b94b067cc91f6cf959dcb93d Mon Sep 17 00:00:00 2001 From: garronej Date: Mon, 27 Dec 2021 19:29:31 +0100 Subject: [PATCH 56/72] update dependencies --- package.json | 4 ++-- yarn.lock | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d0c8806e..95a997b5 100755 --- a/package.json +++ b/package.json @@ -77,11 +77,11 @@ }, "dependencies": { "cheerio": "^1.0.0-rc.5", - "evt": "2.0.0-beta.38", + "evt": "2.0.0-beta.39", "minimal-polyfills": "^2.2.1", "path-browserify": "^1.0.1", "react-markdown": "^5.0.3", "scripting-tools": "^0.19.13", - "tsafe": "^0.8.1" + "tsafe": "^0.9.0" } } diff --git a/yarn.lock b/yarn.lock index 09ed3ffa..f4af9d76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -545,6 +545,15 @@ evt@2.0.0-beta.38: run-exclusive "^2.2.14" tsafe "^0.4.1" +evt@2.0.0-beta.39: + version "2.0.0-beta.39" + resolved "https://registry.yarnpkg.com/evt/-/evt-2.0.0-beta.39.tgz#3c859a83b35940f7eecfb5f148f03b7cbf3fee51" + integrity sha512-XxJkaHrFWBrzjTbnr5LJYXkGkADsAXReZfq2lFu3Kf1iCEw5/5ibrdXu3bQdWW6xkZ8qwAHT3STU9zYcCl09BA== + dependencies: + minimal-polyfills "^2.2.1" + run-exclusive "^2.2.14" + tsafe "^0.4.1" + execa@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -1469,6 +1478,11 @@ tsafe@^0.8.1: resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-0.8.1.tgz#9af7e1540bc04313a82d60c98056a5017c8b086b" integrity sha512-EfPjxQHzndQAV/uh0SMGP26Wg3dCuaw8dRv2VPEuGHen5qzg2oqsMvZw2wkQFkiMisZq2fm95m5lheimW2Fpvg== +tsafe@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-0.9.0.tgz#8394e5fdf81e690c97e2b8be4180a079a4a19bfb" + integrity sha512-wmbu8pI/xmW69b13HoS8WbTcSlRTDjIut9ACblBjVZVTk0vsMRXdoh1k1jMu5EzKNohBavKHhqNOOsccSR7XCA== + tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" From c9b53b0d3a38495824e8e9ae8a0008fe71a47c22 Mon Sep 17 00:00:00 2001 From: garronej Date: Mon, 27 Dec 2021 19:29:59 +0100 Subject: [PATCH 57/72] Bump version (changelog ignore) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 95a997b5..2e80c39f 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "4.2.20", + "version": "4.2.21", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From af5ff1ecfb5074592dfd725d434eefe72cd4dea9 Mon Sep 17 00:00:00 2001 From: actions Date: Mon, 27 Dec 2021 18:32:50 +0000 Subject: [PATCH 58/72] Update changelog v4.2.21 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c99aa238..5d7c4921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### **4.2.21** (2021-12-27) + +- update dependencies + ### **4.2.19** (2021-12-21) - Merge pull request #70 from VBustamante/patch-1 From 97e6aaca65859c53fa72bbbe1a2142711bc13814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B8=D0=BD=20=D0=94=D0=BC?= =?UTF-8?q?=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81?= =?UTF-8?q?=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 28 Dec 2021 00:08:25 +0300 Subject: [PATCH 59/72] feat(*): added login-update-password --- .../generateFtl/generateFtl.ts | 1 + src/lib/components/KcApp.tsx | 3 + src/lib/components/LoginUpdatePassword.tsx | 117 ++++++++++++++++++ src/lib/getKcContext/KcContextBase.ts | 6 + .../kcContextMocks/kcContextMocks.ts | 5 + 5 files changed, 132 insertions(+) create mode 100644 src/lib/components/LoginUpdatePassword.tsx diff --git a/src/bin/build-keycloak-theme/generateFtl/generateFtl.ts b/src/bin/build-keycloak-theme/generateFtl/generateFtl.ts index a2e17203..233bfd6a 100644 --- a/src/bin/build-keycloak-theme/generateFtl/generateFtl.ts +++ b/src/bin/build-keycloak-theme/generateFtl/generateFtl.ts @@ -16,6 +16,7 @@ export const pageIds = [ "terms.ftl", "login-otp.ftl", "login-update-profile.ftl", + "login-update-password.ftl", "login-idp-link-confirm.ftl", ] as const; diff --git a/src/lib/components/KcApp.tsx b/src/lib/components/KcApp.tsx index 91190eba..998b852d 100644 --- a/src/lib/components/KcApp.tsx +++ b/src/lib/components/KcApp.tsx @@ -10,6 +10,7 @@ import { LoginResetPassword } from "./LoginResetPassword"; import { LoginVerifyEmail } from "./LoginVerifyEmail"; import { Terms } from "./Terms"; import { LoginOtp } from "./LoginOtp"; +import { LoginUpdatePassword } from "./LoginUpdatePassword"; import { LoginUpdateProfile } from "./LoginUpdateProfile"; import { LoginIdpLinkConfirm } from "./LoginIdpLinkConfirm"; @@ -33,6 +34,8 @@ export const KcApp = memo(({ kcContext, ...props }: { kcContext: KcContextBase } return ; case "login-otp.ftl": return ; + case "login-update-password.ftl": + return ; case "login-update-profile.ftl": return ; case "login-idp-link-confirm.ftl": diff --git a/src/lib/components/LoginUpdatePassword.tsx b/src/lib/components/LoginUpdatePassword.tsx new file mode 100644 index 00000000..379e2e6d --- /dev/null +++ b/src/lib/components/LoginUpdatePassword.tsx @@ -0,0 +1,117 @@ +import { memo } from "react"; +import { Template } from "./Template"; +import type { KcProps } from "./KcProps"; +import type { KcContextBase } from "../getKcContext/KcContextBase"; +import { useKcMessage } from "../i18n/useKcMessage"; +import { useCssAndCx } from "tss-react"; + +export const LoginUpdatePassword = memo(({ kcContext, ...props }: { kcContext: KcContextBase.LoginUpdatePassword } & KcProps) => { + const { cx } = useCssAndCx(); + + const { msg, msgStr } = useKcMessage(); + + const { url, messagesPerField, isAppInitiatedAction, username } = kcContext; + + return ( +