keycloakify 11.8.23 → 11.8.24
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/README.md +4 -9
- package/login/pages/LoginResetOtp.js +1 -1
- package/login/pages/LoginResetOtp.js.map +1 -1
- package/package.json +1 -1
- package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +4 -1
- package/src/login/pages/LoginResetOtp.tsx +2 -0
- package/src/vite-plugin/vite-plugin.ts +22 -29
- package/stories/login/pages/LoginUpdatePassword.stories.tsx +19 -0
- package/vite-plugin/index.js +22 -29
package/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<br>
|
7
7
|
<br>
|
8
8
|
<a href="https://github.com/garronej/keycloakify/actions">
|
9
|
-
<img src="https://github.com/
|
9
|
+
<img src="https://github.com/keycloakify/keycloakify/actions/workflows/ci.yaml/badge.svg">
|
10
10
|
</a>
|
11
11
|
<a href="https://www.npmjs.com/package/keycloakify">
|
12
12
|
<img src="https://img.shields.io/npm/dm/keycloakify">
|
@@ -96,16 +96,10 @@ Project backers, we trust and recommend their services.
|
|
96
96
|
</a>
|
97
97
|
</p>
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
</div>
|
99
|
+
# Past sponsors
|
104
100
|
|
105
101
|
<div align="center">
|
106
|
-
|
107
|
-

|
108
|
-
|
102
|
+
<img width="200" src="https://user-images.githubusercontent.com/6702424/234135799-68684c33-4ec5-48d4-8763-0f3922c86643.png">
|
109
103
|
</div>
|
110
104
|
|
111
105
|
<p align="center">
|
@@ -172,6 +166,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
172
166
|
<td align="center" valign="top" width="14.28%"><a href="http://t.me/AAT_L"><img src="https://avatars.githubusercontent.com/u/118743608?v=4?s=100" width="100px;" alt="Lesha"/><br /><sub><b>Lesha</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=EternalSide" title="Code">💻</a></td>
|
173
167
|
<td align="center" valign="top" width="14.28%"><a href="https://blog.bacongobbler.com"><img src="https://avatars.githubusercontent.com/u/1360539?v=4?s=100" width="100px;" alt="Matthew Fisher"/><br /><sub><b>Matthew Fisher</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=bacongobbler" title="Documentation">📖</a></td>
|
174
168
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kodebach"><img src="https://avatars.githubusercontent.com/u/23529132?v=4?s=100" width="100px;" alt="Klemens Böswirth"/><br /><sub><b>Klemens Böswirth</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=kodebach" title="Code">💻</a></td>
|
169
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/wnmzzzz"><img src="https://avatars.githubusercontent.com/u/117174301?v=4?s=100" width="100px;" alt="wnmzzzz"/><br /><sub><b>wnmzzzz</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=wnmzzzz" title="Tests">⚠️</a></td>
|
175
170
|
</tr>
|
176
171
|
</tbody>
|
177
172
|
</table>
|
@@ -9,6 +9,6 @@ export default function LoginResetOtp(props) {
|
|
9
9
|
});
|
10
10
|
const { url, messagesPerField, configuredOtpCredentials } = kcContext;
|
11
11
|
const { msg, msgStr } = i18n;
|
12
|
-
return (
|
12
|
+
return (_jsxs(Template, Object.assign({ kcContext: kcContext, i18n: i18n, doUseDefaultCss: doUseDefaultCss, classes: classes, displayMessage: !messagesPerField.existsError("totp"), headerNode: msg("doLogIn") }, { children: [_jsx("form", Object.assign({ id: "kc-otp-reset-form", className: kcClsx("kcFormClass"), action: url.loginAction, method: "post" }, { children: _jsx("div", Object.assign({ className: kcClsx("kcInputWrapperClass") }, { children: _jsxs("div", Object.assign({ className: kcClsx("kcInfoAreaWrapperClass") }, { children: [_jsx("p", Object.assign({ id: "kc-otp-reset-form-description" }, { children: msg("otp-reset-description") })), configuredOtpCredentials.userOtpCredentials.map((otpCredential, index) => (_jsxs(Fragment, { children: [_jsx("input", { id: `kc-otp-credential-${index}`, className: kcClsx("kcLoginOTPListInputClass"), type: "radio", name: "selectedCredentialId", value: otpCredential.id, defaultChecked: otpCredential.id === configuredOtpCredentials.selectedCredentialId }), _jsx("label", Object.assign({ htmlFor: `kc-otp-credential-${index}`, className: kcClsx("kcLoginOTPListClass"), tabIndex: index }, { children: _jsxs("span", Object.assign({ className: kcClsx("kcLoginOTPListItemHeaderClass") }, { children: [_jsx("span", Object.assign({ className: kcClsx("kcLoginOTPListItemIconBodyClass") }, { children: _jsx("i", { className: kcClsx("kcLoginOTPListItemIconClass"), "aria-hidden": "true" }) })), _jsx("span", Object.assign({ className: kcClsx("kcLoginOTPListItemTitleClass") }, { children: otpCredential.userLabel }))] })) }))] }, otpCredential.id))), _jsx("div", Object.assign({ className: kcClsx("kcFormGroupClass") }, { children: _jsx("div", Object.assign({ id: "kc-form-buttons", className: kcClsx("kcFormButtonsClass") }, { children: _jsx("input", { id: "kc-otp-reset-form-submit", className: kcClsx("kcButtonClass", "kcButtonPrimaryClass", "kcButtonBlockClass", "kcButtonLargeClass"), type: "submit", value: msgStr("doSubmit") }) })) }))] })) })) })), _jsx("div", { className: "clearfix" })] })));
|
13
13
|
}
|
14
14
|
//# sourceMappingURL=LoginResetOtp.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LoginResetOtp.js","sourceRoot":"","sources":["../../src/login/pages/LoginResetOtp.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
1
|
+
{"version":3,"file":"LoginResetOtp.js","sourceRoot":"","sources":["../../src/login/pages/LoginResetOtp.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAMzD,MAAM,CAAC,OAAO,UAAU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,CAAC,oBAAoB,GACpF,EACF,8BAAO,OAAO,EAAE,qBAAqB,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,EAAE,QAAQ,EAAE,KAAK,gBACnG,8BAAM,SAAS,EAAE,MAAM,CAAC,+BAA+B,CAAC,iBACpD,6BAAM,SAAS,EAAE,MAAM,CAAC,iCAAiC,CAAC,gBACtD,YAAG,SAAS,EAAE,MAAM,CAAC,6BAA6B,CAAC,iBAAc,MAAM,GAAK,IACzE,EACP,6BAAM,SAAS,EAAE,MAAM,CAAC,8BAA8B,CAAC,gBAAG,aAAa,CAAC,SAAS,IAAQ,KACtF,IACH,KAhBG,aAAa,CAAC,EAAE,CAiBpB,CACd,CAAC,EACF,4BAAK,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,gBACtC,4BAAK,EAAE,EAAC,iBAAiB,EAAC,SAAS,EAAE,MAAM,CAAC,oBAAoB,CAAC,gBAC7D,gBACI,EAAE,EAAC,0BAA0B,EAC7B,SAAS,EAAE,MAAM,CAAC,eAAe,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,EACtG,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,GAC3B,IACA,IACJ,KACJ,IACJ,IACH,EACP,cAAK,SAAS,EAAC,UAAU,GAAG,KACrB,CACd,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
@@ -109,13 +109,16 @@ redirect_to_dev_server: {
|
|
109
109
|
|
110
110
|
const redirectUrl = new URL(window.location.href);
|
111
111
|
|
112
|
+
const keycloakServerPort = redirectUrl.port;
|
113
|
+
|
112
114
|
redirectUrl.port = devSeverPort;
|
113
115
|
|
114
116
|
delete kcContext.msgJSON;
|
115
117
|
|
116
118
|
console.log(kcContext);
|
117
119
|
|
118
|
-
redirectUrl.searchParams.set("kcContext",
|
120
|
+
redirectUrl.searchParams.set("kcContext", JSON.stringify(kcContext));
|
121
|
+
redirectUrl.searchParams.set("keycloakServerPort", keycloakServerPort);
|
119
122
|
|
120
123
|
window.location.href = redirectUrl.toString();
|
121
124
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Fragment } from "react";
|
2
2
|
import { getKcClsx } from "keycloakify/login/lib/kcClsx";
|
3
|
+
|
3
4
|
import type { PageProps } from "keycloakify/login/pages/PageProps";
|
4
5
|
import type { KcContext } from "../KcContext";
|
5
6
|
import type { I18n } from "../i18n";
|
@@ -62,6 +63,7 @@ export default function LoginResetOtp(props: PageProps<Extract<KcContext, { page
|
|
62
63
|
</div>
|
63
64
|
</div>
|
64
65
|
</form>
|
66
|
+
<div className="clearfix" />
|
65
67
|
</Template>
|
66
68
|
);
|
67
69
|
}
|
@@ -228,53 +228,46 @@ export function keycloakify(params: keycloakify.Params) {
|
|
228
228
|
const scriptContent = `
|
229
229
|
(()=>{
|
230
230
|
|
231
|
-
const
|
231
|
+
const url = new URL(window.location.href);
|
232
232
|
|
233
|
-
|
233
|
+
const kcContext_str = url.searchParams.get("kcContext");
|
234
234
|
|
235
|
-
|
235
|
+
if( kcContext_str === null ){
|
236
236
|
|
237
|
-
|
237
|
+
const keycloakServerPort = sessionStorage.getItem("keycloakServerPort");
|
238
238
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
break read_from_url_case;
|
243
|
-
}
|
244
|
-
|
245
|
-
url.searchParams.delete(paramName);
|
239
|
+
if( keycloakServerPort === null ){
|
240
|
+
return;
|
241
|
+
}
|
246
242
|
|
247
|
-
|
243
|
+
const redirectUrl = new URL(window.location.href);
|
248
244
|
|
249
|
-
|
245
|
+
redirectUrl.port = keycloakServerPort;
|
250
246
|
|
251
|
-
|
247
|
+
window.location.href = redirectUrl;
|
252
248
|
|
253
|
-
|
249
|
+
return;
|
254
250
|
|
255
|
-
|
256
|
-
|
257
|
-
read_from_session_storage_case: {
|
251
|
+
}
|
258
252
|
|
259
|
-
|
253
|
+
url.searchParams.delete("kcContext");
|
260
254
|
|
261
|
-
|
262
|
-
break read_from_session_storage_case;
|
263
|
-
}
|
255
|
+
{
|
264
256
|
|
265
|
-
|
257
|
+
const keycloakServerPort = url.searchParams.get("keycloakServerPort");
|
266
258
|
|
259
|
+
if( keycloakServerPort === null ){
|
260
|
+
throw new Error("Wrong assertion");
|
267
261
|
}
|
268
262
|
|
269
|
-
|
270
|
-
|
271
|
-
})();
|
263
|
+
sessionStorage.setItem("keycloakServerPort", keycloakServerPort);
|
264
|
+
url.searchParams.delete("keycloakServerPort");
|
272
265
|
|
273
|
-
if( kcContext === undefined ){
|
274
|
-
return;
|
275
266
|
}
|
276
267
|
|
277
|
-
window.
|
268
|
+
window.history.replaceState({}, "", url);
|
269
|
+
|
270
|
+
window.kcContext = JSON.parse(kcContext_str);
|
278
271
|
|
279
272
|
})();
|
280
273
|
`;
|
@@ -62,3 +62,22 @@ export const WithPasswordConfirmError: Story = {
|
|
62
62
|
/>
|
63
63
|
)
|
64
64
|
};
|
65
|
+
|
66
|
+
/**
|
67
|
+
* WithAppInitiatedAction:
|
68
|
+
* - Purpose: Tests when the update password action was triggered by an app.
|
69
|
+
* - Scenario: Simulates the case where the user presses a 'change password' button in an app and is redirected to Keycloak to change it.
|
70
|
+
* - Key Aspect: Ensures the 'Cancel' button is shown correctly, which displays only when the action is app initiated.
|
71
|
+
*/
|
72
|
+
export const WithAppInitiatedAction: Story = {
|
73
|
+
render: () => (
|
74
|
+
<KcPageStory
|
75
|
+
kcContext={{
|
76
|
+
url: {
|
77
|
+
loginAction: "/mock-login-action"
|
78
|
+
},
|
79
|
+
isAppInitiatedAction: true
|
80
|
+
}}
|
81
|
+
/>
|
82
|
+
)
|
83
|
+
};
|
package/vite-plugin/index.js
CHANGED
@@ -2117,53 +2117,46 @@ function keycloakify(params) {
|
|
2117
2117
|
const scriptContent = `
|
2118
2118
|
(()=>{
|
2119
2119
|
|
2120
|
-
const
|
2120
|
+
const url = new URL(window.location.href);
|
2121
2121
|
|
2122
|
-
|
2122
|
+
const kcContext_str = url.searchParams.get("kcContext");
|
2123
2123
|
|
2124
|
-
|
2124
|
+
if( kcContext_str === null ){
|
2125
2125
|
|
2126
|
-
|
2126
|
+
const keycloakServerPort = sessionStorage.getItem("keycloakServerPort");
|
2127
2127
|
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
break read_from_url_case;
|
2132
|
-
}
|
2133
|
-
|
2134
|
-
url.searchParams.delete(paramName);
|
2135
|
-
|
2136
|
-
window.history.replaceState({}, "", url);
|
2128
|
+
if( keycloakServerPort === null ){
|
2129
|
+
return;
|
2130
|
+
}
|
2137
2131
|
|
2138
|
-
|
2132
|
+
const redirectUrl = new URL(window.location.href);
|
2139
2133
|
|
2140
|
-
|
2134
|
+
redirectUrl.port = keycloakServerPort;
|
2141
2135
|
|
2142
|
-
|
2136
|
+
window.location.href = redirectUrl;
|
2143
2137
|
|
2144
|
-
|
2138
|
+
return;
|
2145
2139
|
|
2146
|
-
|
2140
|
+
}
|
2147
2141
|
|
2148
|
-
|
2142
|
+
url.searchParams.delete("kcContext");
|
2149
2143
|
|
2150
|
-
|
2151
|
-
break read_from_session_storage_case;
|
2152
|
-
}
|
2144
|
+
{
|
2153
2145
|
|
2154
|
-
|
2146
|
+
const keycloakServerPort = url.searchParams.get("keycloakServerPort");
|
2155
2147
|
|
2148
|
+
if( keycloakServerPort === null ){
|
2149
|
+
throw new Error("Wrong assertion");
|
2156
2150
|
}
|
2157
2151
|
|
2158
|
-
|
2159
|
-
|
2160
|
-
})();
|
2152
|
+
sessionStorage.setItem("keycloakServerPort", keycloakServerPort);
|
2153
|
+
url.searchParams.delete("keycloakServerPort");
|
2161
2154
|
|
2162
|
-
if( kcContext === undefined ){
|
2163
|
-
return;
|
2164
2155
|
}
|
2165
2156
|
|
2166
|
-
window.
|
2157
|
+
window.history.replaceState({}, "", url);
|
2158
|
+
|
2159
|
+
window.kcContext = JSON.parse(kcContext_str);
|
2167
2160
|
|
2168
2161
|
})();
|
2169
2162
|
`;
|