keycloakify 10.0.0-rc.2 → 10.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/account/Template.js +2 -2
- package/account/Template.js.map +1 -1
- package/account/i18n/i18n.d.ts +3 -4
- package/account/i18n/i18n.js +2 -3
- package/account/i18n/i18n.js.map +1 -1
- package/account/kcContext/KcContext.d.ts +0 -15
- package/account/kcContext/KcContext.js.map +1 -1
- package/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +160 -243
- package/bin/keycloakify/generateFtl/generateFtl.js +1 -1
- package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
- package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +2 -0
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js +9 -12
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +1 -1
- package/bin/keycloakify/keycloakify.js +1 -0
- package/bin/keycloakify/keycloakify.js.map +1 -1
- package/login/Template.js +2 -2
- package/login/Template.js.map +1 -1
- package/login/UserProfileFormFields.js +2 -4
- package/login/UserProfileFormFields.js.map +1 -1
- package/login/i18n/i18n.d.ts +3 -4
- package/login/i18n/i18n.js +2 -3
- package/login/i18n/i18n.js.map +1 -1
- package/login/lib/useUserProfileForm.js +9 -9
- package/login/lib/useUserProfileForm.js.map +1 -1
- package/login/pages/Code.js +1 -1
- package/login/pages/Code.js.map +1 -1
- package/login/pages/IdpReviewUserProfile.js.map +1 -1
- package/login/pages/Login.js +1 -1
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginUpdateProfile.js +1 -1
- package/login/pages/LoginUpdateProfile.js.map +1 -1
- package/login/pages/LoginUsername.js +1 -1
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/Register.js +1 -1
- package/login/pages/Register.js.map +1 -1
- package/login/pages/UpdateEmail.js.map +1 -1
- package/login/pages/WebauthnRegister.js +1 -1
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/package.json +1 -7
- package/src/account/Template.tsx +2 -5
- package/src/account/i18n/i18n.tsx +5 -8
- package/src/account/kcContext/KcContext.ts +0 -15
- package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +160 -243
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +1 -1
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +13 -14
- package/src/bin/keycloakify/keycloakify.ts +1 -0
- package/src/login/Template.tsx +6 -22
- package/src/login/UserProfileFormFields.tsx +2 -5
- package/src/login/i18n/i18n.tsx +5 -8
- package/src/login/lib/useUserProfileForm.tsx +10 -10
- package/src/login/pages/Code.tsx +1 -1
- package/src/login/pages/IdpReviewUserProfile.tsx +1 -1
- package/src/login/pages/Login.tsx +1 -1
- package/src/login/pages/LoginUpdateProfile.tsx +1 -1
- package/src/login/pages/LoginUsername.tsx +1 -1
- package/src/login/pages/Register.tsx +1 -1
- package/src/login/pages/UpdateEmail.tsx +1 -1
- package/src/login/pages/WebauthnRegister.tsx +1 -1
- package/bin/tools/grant-exec-perms.d.ts +0 -1
- package/bin/tools/grant-exec-perms.js +0 -100
- package/bin/tools/grant-exec-perms.js.map +0 -1
- package/src/bin/tools/grant-exec-perms.ts +0 -19
package/src/login/i18n/i18n.tsx
CHANGED
@@ -28,11 +28,10 @@ export type GenericI18n<MessageKey extends string> = {
|
|
28
28
|
*/
|
29
29
|
currentLanguageTag: string;
|
30
30
|
/**
|
31
|
-
*
|
32
|
-
*
|
33
|
-
* on next load currentLanguageTag === newLanguageTag
|
31
|
+
* Redirect to this url to change the language.
|
32
|
+
* After reload currentLanguageTag === newLanguageTag
|
34
33
|
*/
|
35
|
-
|
34
|
+
getChangeLocalUrl: (newLanguageTag: string) => string;
|
36
35
|
/**
|
37
36
|
* e.g. "en" => "English", "fr" => "Français", ...
|
38
37
|
*
|
@@ -104,7 +103,7 @@ export function createUseI18n<ExtraMessageKey extends string = never>(extraMessa
|
|
104
103
|
} as any
|
105
104
|
}),
|
106
105
|
currentLanguageTag,
|
107
|
-
"
|
106
|
+
"getChangeLocalUrl": newLanguageTag => {
|
108
107
|
const { locale } = kcContext;
|
109
108
|
|
110
109
|
assert(locale !== undefined, "Internationalization not enabled");
|
@@ -113,9 +112,7 @@ export function createUseI18n<ExtraMessageKey extends string = never>(extraMessa
|
|
113
112
|
|
114
113
|
assert(targetSupportedLocale !== undefined, `${newLanguageTag} need to be enabled in Keycloak admin`);
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
assert(false, "never");
|
115
|
+
return targetSupportedLocale.url;
|
119
116
|
},
|
120
117
|
"labelBySupportedLanguageTag": Object.fromEntries(
|
121
118
|
(kcContext.locale?.supported ?? []).map(({ languageTag, label }) => [languageTag, label])
|
@@ -354,15 +354,15 @@ export function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTy
|
|
354
354
|
return initialState;
|
355
355
|
}, []);
|
356
356
|
|
357
|
-
const [state, dispatchFormAction] = useReducer(function reducer(state: internal.State,
|
358
|
-
const formFieldState = state.formFieldStates.find(({ attribute }) => attribute.name ===
|
357
|
+
const [state, dispatchFormAction] = useReducer(function reducer(state: internal.State, formAction: FormAction): internal.State {
|
358
|
+
const formFieldState = state.formFieldStates.find(({ attribute }) => attribute.name === formAction.name);
|
359
359
|
|
360
360
|
assert(formFieldState !== undefined);
|
361
361
|
|
362
362
|
(() => {
|
363
|
-
switch (
|
363
|
+
switch (formAction.action) {
|
364
364
|
case "update":
|
365
|
-
formFieldState.valueOrValues =
|
365
|
+
formFieldState.valueOrValues = formAction.valueOrValues;
|
366
366
|
|
367
367
|
apply_formatters: {
|
368
368
|
const { attribute } = formFieldState;
|
@@ -381,7 +381,7 @@ export function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTy
|
|
381
381
|
}
|
382
382
|
|
383
383
|
formFieldState.errors = getErrors({
|
384
|
-
"attributeName":
|
384
|
+
"attributeName": formAction.name,
|
385
385
|
"formFieldStates": state.formFieldStates
|
386
386
|
});
|
387
387
|
|
@@ -390,21 +390,21 @@ export function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTy
|
|
390
390
|
break update_password_confirm;
|
391
391
|
}
|
392
392
|
|
393
|
-
if (
|
393
|
+
if (formAction.name !== "password") {
|
394
394
|
break update_password_confirm;
|
395
395
|
}
|
396
396
|
|
397
397
|
state = reducer(state, {
|
398
398
|
"action": "update",
|
399
399
|
"name": "password-confirm",
|
400
|
-
"valueOrValues":
|
400
|
+
"valueOrValues": formAction.valueOrValues
|
401
401
|
});
|
402
402
|
}
|
403
403
|
|
404
404
|
return;
|
405
405
|
case "focus lost":
|
406
406
|
if (formFieldState.hasLostFocusAtLeastOnce instanceof Array) {
|
407
|
-
const { fieldIndex } =
|
407
|
+
const { fieldIndex } = formAction;
|
408
408
|
assert(fieldIndex !== undefined);
|
409
409
|
formFieldState.hasLostFocusAtLeastOnce[fieldIndex] = true;
|
410
410
|
return;
|
@@ -413,10 +413,10 @@ export function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTy
|
|
413
413
|
formFieldState.hasLostFocusAtLeastOnce = true;
|
414
414
|
return;
|
415
415
|
}
|
416
|
-
assert<Equals<typeof
|
416
|
+
assert<Equals<typeof formAction, never>>(false);
|
417
417
|
})();
|
418
418
|
|
419
|
-
return state;
|
419
|
+
return { ...state };
|
420
420
|
}, initialState);
|
421
421
|
|
422
422
|
const formState: FormState = useMemo(
|
package/src/login/pages/Code.tsx
CHANGED
@@ -24,7 +24,7 @@ export default function Code(props: PageProps<Extract<KcContext, { pageId: "code
|
|
24
24
|
{code.success ? (
|
25
25
|
<>
|
26
26
|
<p>{msg("copyCodeInstruction")}</p>
|
27
|
-
<input id="code" className={getClassName("kcTextareaClass")}
|
27
|
+
<input id="code" className={getClassName("kcTextareaClass")} defaultValue={code.code} />
|
28
28
|
</>
|
29
29
|
) : (
|
30
30
|
<p id="error">{code.error}</p>
|
@@ -29,7 +29,7 @@ export default function IdpReviewUserProfile(props: IdpReviewUserProfileProps) {
|
|
29
29
|
<Template
|
30
30
|
{...{ kcContext, i18n, doUseDefaultCss, classes }}
|
31
31
|
displayMessage={messagesPerField.exists("global")}
|
32
|
-
displayRequiredFields
|
32
|
+
displayRequiredFields
|
33
33
|
headerNode={msg("loginIdpReviewProfileTitle")}
|
34
34
|
>
|
35
35
|
<form id="kc-idp-review-profile-form" className={getClassName("kcFormClass")} action={url.loginAction} method="post">
|
@@ -104,7 +104,7 @@ export default function Login(props: PageProps<Extract<KcContext, { pageId: "log
|
|
104
104
|
id="username"
|
105
105
|
className={getClassName("kcInputClass")}
|
106
106
|
name="username"
|
107
|
-
|
107
|
+
defaultValue={login.username ?? ""}
|
108
108
|
type="text"
|
109
109
|
autoFocus
|
110
110
|
autoComplete="username"
|
@@ -26,7 +26,7 @@ export default function LoginUpdateProfile(props: LoginUpdateProfileProps) {
|
|
26
26
|
const [isFormSubmittable, setIsFormSubmittable] = useState(false);
|
27
27
|
|
28
28
|
return (
|
29
|
-
<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} headerNode={msg("loginProfileTitle")}>
|
29
|
+
<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} displayRequiredFields headerNode={msg("loginProfileTitle")}>
|
30
30
|
<form id="kc-update-profile-form" className={getClassName("kcFormClass")} action={url.loginAction} method="post">
|
31
31
|
<UserProfileFormFields
|
32
32
|
{...{
|
@@ -101,7 +101,7 @@ export default function LoginUsername(props: PageProps<Extract<KcContext, { page
|
|
101
101
|
id="username"
|
102
102
|
className={getClassName("kcInputClass")}
|
103
103
|
name="username"
|
104
|
-
|
104
|
+
defaultValue={login.username ?? ""}
|
105
105
|
type="text"
|
106
106
|
autoFocus
|
107
107
|
autoComplete="off"
|
@@ -28,7 +28,7 @@ export default function Register(props: RegisterProps) {
|
|
28
28
|
const [isFormSubmittable, setIsFormSubmittable] = useState(false);
|
29
29
|
|
30
30
|
return (
|
31
|
-
<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} headerNode={msg("registerTitle")}>
|
31
|
+
<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} headerNode={msg("registerTitle")} displayRequiredFields>
|
32
32
|
<form id="kc-register-form" className={getClassName("kcFormClass")} action={url.registrationAction} method="post">
|
33
33
|
<UserProfileFormFields
|
34
34
|
{...{
|
@@ -29,7 +29,7 @@ export default function UpdateEmail(props: UpdateEmailProps) {
|
|
29
29
|
<Template
|
30
30
|
{...{ kcContext, i18n, doUseDefaultCss, classes }}
|
31
31
|
displayMessage={messagesPerField.exists("global")}
|
32
|
-
displayRequiredFields
|
32
|
+
displayRequiredFields
|
33
33
|
headerNode={msg("updateEmailTitle")}
|
34
34
|
>
|
35
35
|
<form id="kc-update-email-form" className={getClassName("kcFormClass")} action={url.loginAction} method="post">
|
@@ -275,7 +275,7 @@ function LogoutOtherSessions(props: { i18n: I18n; getClassName: ReturnType<typeo
|
|
275
275
|
<div className={getClassName("kcFormOptionsWrapperClass")}>
|
276
276
|
<div className="checkbox">
|
277
277
|
<label>
|
278
|
-
<input type="checkbox" id="logout-sessions" name="logout-sessions" value="on"
|
278
|
+
<input type="checkbox" id="logout-sessions" name="logout-sessions" value="on" defaultChecked={true} />
|
279
279
|
{msg("logoutOtherSessions")}
|
280
280
|
</label>
|
281
281
|
</div>
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,100 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
|
-
});
|
33
|
-
};
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
38
|
-
function step(op) {
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
40
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
43
|
-
switch (op[0]) {
|
44
|
-
case 0: case 1: t = op; break;
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
48
|
-
default:
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
53
|
-
if (t[2]) _.ops.pop();
|
54
|
-
_.trys.pop(); continue;
|
55
|
-
}
|
56
|
-
op = body.call(thisArg, _);
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
59
|
-
}
|
60
|
-
};
|
61
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
62
|
-
var getThisCodebaseRootDirPath_1 = require("./getThisCodebaseRootDirPath");
|
63
|
-
var path_1 = require("path");
|
64
|
-
var fs_1 = require("fs");
|
65
|
-
var promises_1 = require("fs/promises");
|
66
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
67
|
-
var thisCodebaseRootDirPath, bin, promises;
|
68
|
-
return __generator(this, function (_a) {
|
69
|
-
var _b;
|
70
|
-
switch (_a.label) {
|
71
|
-
case 0:
|
72
|
-
thisCodebaseRootDirPath = (0, getThisCodebaseRootDirPath_1.getThisCodebaseRootDirPath)();
|
73
|
-
return [4 /*yield*/, (_b = (0, path_1.join)(thisCodebaseRootDirPath, "package.json"), Promise.resolve().then(function () { return __importStar(require(_b)); }))];
|
74
|
-
case 1:
|
75
|
-
bin = (_a.sent()).bin;
|
76
|
-
promises = Object.values(bin).map(function (scriptPath) { return __awaiter(void 0, void 0, void 0, function () {
|
77
|
-
var fullPath, oldMode, newMode;
|
78
|
-
return __generator(this, function (_a) {
|
79
|
-
switch (_a.label) {
|
80
|
-
case 0:
|
81
|
-
fullPath = (0, path_1.join)(thisCodebaseRootDirPath, scriptPath);
|
82
|
-
return [4 /*yield*/, (0, promises_1.stat)(fullPath)];
|
83
|
-
case 1:
|
84
|
-
oldMode = (_a.sent()).mode;
|
85
|
-
newMode = oldMode | fs_1.constants.S_IXUSR | fs_1.constants.S_IXGRP | fs_1.constants.S_IXOTH;
|
86
|
-
return [4 /*yield*/, (0, promises_1.chmod)(fullPath, newMode)];
|
87
|
-
case 2:
|
88
|
-
_a.sent();
|
89
|
-
return [2 /*return*/];
|
90
|
-
}
|
91
|
-
});
|
92
|
-
}); });
|
93
|
-
return [4 /*yield*/, Promise.all(promises)];
|
94
|
-
case 2:
|
95
|
-
_a.sent();
|
96
|
-
return [2 /*return*/];
|
97
|
-
}
|
98
|
-
});
|
99
|
-
}); })();
|
100
|
-
//# sourceMappingURL=grant-exec-perms.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"grant-exec-perms.js","sourceRoot":"","sources":["../../src/bin/tools/grant-exec-perms.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2EAA0E;AAC1E,6BAAwC;AACxC,yBAA+B;AAC/B,wCAA0C;AAE1C,CAAC;;;;;;gBACS,uBAAuB,GAAG,IAAA,uDAA0B,GAAE,CAAC;gBAE7C,2BAAa,IAAA,WAAQ,EAAC,uBAAuB,EAAE,cAAc,CAAC,8EAAC;;gBAAvE,GAAG,GAAK,CAAA,SAA+D,CAAA,IAApE;gBAEL,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAS,GAAG,CAAC,CAAC,GAAG,CAAC,UAAM,UAAU;;;;;gCACtD,QAAQ,GAAG,IAAA,WAAQ,EAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC;gCAC9C,qBAAM,IAAA,eAAI,EAAC,QAAQ,CAAC,EAAA;;gCAA/B,OAAO,GAAG,CAAC,SAAoB,CAAC,CAAC,IAAI;gCACrC,OAAO,GAAG,OAAO,GAAG,cAAS,CAAC,OAAO,GAAG,cAAS,CAAC,OAAO,GAAG,cAAS,CAAC,OAAO,CAAC;gCACpF,qBAAM,IAAA,gBAAK,EAAC,QAAQ,EAAE,OAAO,CAAC,EAAA;;gCAA9B,SAA8B,CAAC;;;;qBAClC,CAAC,CAAC;gBAEH,qBAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAA;;gBAA3B,SAA2B,CAAC;;;;KAC/B,CAAC,EAAE,CAAC"}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { getThisCodebaseRootDirPath } from "./getThisCodebaseRootDirPath";
|
2
|
-
import { join as pathJoin } from "path";
|
3
|
-
import { constants } from "fs";
|
4
|
-
import { chmod, stat } from "fs/promises";
|
5
|
-
|
6
|
-
(async () => {
|
7
|
-
const thisCodebaseRootDirPath = getThisCodebaseRootDirPath();
|
8
|
-
|
9
|
-
const { bin } = await import(pathJoin(thisCodebaseRootDirPath, "package.json"));
|
10
|
-
|
11
|
-
const promises = Object.values<string>(bin).map(async scriptPath => {
|
12
|
-
const fullPath = pathJoin(thisCodebaseRootDirPath, scriptPath);
|
13
|
-
const oldMode = (await stat(fullPath)).mode;
|
14
|
-
const newMode = oldMode | constants.S_IXUSR | constants.S_IXGRP | constants.S_IXOTH;
|
15
|
-
await chmod(fullPath, newMode);
|
16
|
-
});
|
17
|
-
|
18
|
-
await Promise.all(promises);
|
19
|
-
})();
|