@genesislcap/foundation-auth 15.25.1 → 15.26.0
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/dist/dts/machine/actions.d.ts.map +1 -1
- package/dist/dts/machine/machine.d.ts.map +1 -1
- package/dist/dts/mapper/utils.d.ts +5 -0
- package/dist/dts/mapper/utils.d.ts.map +1 -1
- package/dist/dts/routes/reset-password/reset-password.d.ts.map +1 -1
- package/dist/esm/machine/actions.js +22 -2
- package/dist/esm/machine/machine.js +96 -28
- package/dist/esm/mapper/utils.js +6 -1
- package/dist/esm/routes/base.js +1 -1
- package/dist/esm/routes/reset-password/reset-password.js +11 -2
- package/dist/esm/translation.json +2 -1
- package/dist/foundation-auth.d.ts +5 -0
- package/package.json +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/machine/actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/machine/actions.ts"],"names":[],"mappings":"AAmBA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;;;;;;CAoBnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/machine/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,YAAY,EACZ,iBAAiB,EAMjB,OAAO,EACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACL,IAAI,
|
|
1
|
+
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/machine/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,YAAY,EACZ,iBAAiB,EAMjB,OAAO,EACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACL,IAAI,EASL,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAEL,iBAAiB,EAIlB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,iBAAiB,EAQlB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,KAAK,EAEV,kBAAkB,EAClB,gBAAgB,EAGhB,WAAW,EACX,WAAW,EAEZ,MAAM,SAAS,CAAC;AAGjB;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;CAAG;AAErF;;;GAGG;AACH,qBAAa,kBACX,SAAQ,eAAe,CAAC,kBAAkB,EAAE,gBAAgB,CAC5D,YAAW,WAAW;IAGd,OAAO,CAAC,IAAI;IACJ,OAAO,CAAC,YAAY;IACf,OAAO,CAAC,EAAE;IACvB,OAAO,CAAC,IAAI;IACC,OAAO,CAAC,aAAa;IAC5B,OAAO,CAAC,MAAM;IACb,OAAO,CAAC,OAAO;gBANd,IAAI,EAAE,IAAI,EACF,YAAY,EAAE,YAAY,EACrB,EAAE,EAAE,iBAAiB,EAClC,IAAI,EAAE,IAAI,EACG,aAAa,EAAE,iBAAiB,EACvC,MAAM,EAAE,UAAU,EACjB,OAAO,EAAE,WAAW;IAytB3C,KAAK,CACH,OAAO,GAAE,kBAAkB,CAAC,OAAO,IAAI,CAAC,OAAO,CAM9C;IAKH;;OAEG;IACH,gBAAgB,IAAI,IAAI;IAIxB,SAAS,CAAC,sBAAsB,IAAI,WAAW;IAQ/C,SAAS,CAAC,+BAA+B,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW;IAuB3E,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,iBAAiB;IAgB3E,SAAS,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;MAwBpB;IAEF,SAAS,CAAC,aAAa;;;MAGpB;CACJ;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,mEAA0E,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
|
|
@@ -8,6 +8,11 @@ export declare const fromDTOStringArray: (arr: string[]) => string[];
|
|
|
8
8
|
* getNormalisedText
|
|
9
9
|
* @param arr - A NackErrorWarning array.
|
|
10
10
|
* @returns A combined text string.
|
|
11
|
+
* @remarks
|
|
12
|
+
* Joins message texts with `\n` deliberately so multi-error NACKs render as separate
|
|
13
|
+
* lines under `white-space: pre-line` (e.g. auth MessageElement). Consumers that
|
|
14
|
+
* surface `NackError.message` without a pre-line renderer (toasts, etc.) will see a
|
|
15
|
+
* literal newline where a space was used historically.
|
|
11
16
|
* @internal
|
|
12
17
|
*/
|
|
13
18
|
export declare const getNormalisedText: (arr: NackErrorWarning[]) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mapper/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAsB,MAAM,QAAQ,CAAC;AAC/E,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,KAAG,MAAM,EACN,CAAC;AA0CpD
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mapper/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAsB,MAAM,QAAQ,CAAC;AAC/E,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,KAAG,MAAM,EACN,CAAC;AA0CpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,gBAAgB,EAAE,KAAG,MAC0B,CAAC;AAEvF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,KAAK,IAAI,EAAE,MAAM,MAAM,YAI7D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,GAAG,KAAG,GAGpC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,IAAI,KAAG,IAavC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,iBAAiB,KAAG,gBAMnD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,IAAI,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,IAAI,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,WAAW,GAAE,MAA0C,GACtD,WAAW,CAWb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset-password.d.ts","sourceRoot":"","sources":["../../../../src/routes/reset-password/reset-password.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC;;;;;;;;;;;;;GAaG;AACH,qBAKa,aAAc,SAAQ,SAAS;IAC9B,kBAAkB,EAAE,OAAO,CAAS;IACpC,kBAAkB,EAAE,MAAM,CAAM;IAE5C,KAAK,CAAC,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"reset-password.d.ts","sourceRoot":"","sources":["../../../../src/routes/reset-password/reset-password.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC;;;;;;;;;;;;;GAaG;AACH,qBAKa,aAAc,SAAQ,SAAS;IAC9B,kBAAkB,EAAE,OAAO,CAAS;IACpC,kBAAkB,EAAE,MAAM,CAAM;IAE5C,KAAK,CAAC,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC;IAehC,QAAQ;IAwBd,IACI,WAAW,mEAEd;CACF"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { isErrorEvent } from '@genesislcap/foundation-state-machine';
|
|
1
|
+
import { isDoneInvokeEvent, isErrorEvent } from '@genesislcap/foundation-state-machine';
|
|
2
2
|
import { assign } from 'xstate';
|
|
3
|
+
import { fromDTONack, isNackDTO } from '../mapper';
|
|
3
4
|
import { logger } from '../utils';
|
|
4
5
|
import { NackError } from './errors';
|
|
5
6
|
import { is200Nack } from './guards';
|
|
7
|
+
const nackErrorFrom = (value) => {
|
|
8
|
+
if (isNackDTO(value)) {
|
|
9
|
+
return NackError.fromEntity(fromDTONack(value));
|
|
10
|
+
}
|
|
11
|
+
const nested = value === null || value === void 0 ? void 0 : value.data;
|
|
12
|
+
if (isNackDTO(nested)) {
|
|
13
|
+
return NackError.fromEntity(fromDTONack(nested));
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
6
17
|
/**
|
|
7
18
|
* Set error action.
|
|
8
19
|
* @remarks
|
|
@@ -10,9 +21,10 @@ import { is200Nack } from './guards';
|
|
|
10
21
|
* @public
|
|
11
22
|
*/
|
|
12
23
|
export const setError = assign(({ event }) => {
|
|
24
|
+
var _a;
|
|
13
25
|
if (isErrorEvent(event)) {
|
|
14
26
|
return {
|
|
15
|
-
error: event.data,
|
|
27
|
+
error: (_a = nackErrorFrom(event.data)) !== null && _a !== void 0 ? _a : event.data,
|
|
16
28
|
};
|
|
17
29
|
}
|
|
18
30
|
if (is200Nack(event)) {
|
|
@@ -21,4 +33,12 @@ export const setError = assign(({ event }) => {
|
|
|
21
33
|
error: NackError.fromEntity(event.output),
|
|
22
34
|
};
|
|
23
35
|
}
|
|
36
|
+
if (isDoneInvokeEvent(event)) {
|
|
37
|
+
const nackError = nackErrorFrom(event.output);
|
|
38
|
+
if (nackError) {
|
|
39
|
+
return {
|
|
40
|
+
error: nackError,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
24
44
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __param } from "tslib";
|
|
2
2
|
import { AbstractMachine, createErrorStateNode, FetchMachine, isDoneInvokeEvent, isErrorEvent, isEventWithParams, isUnauthorizedError, } from '@genesislcap/foundation-state-machine';
|
|
3
3
|
import { User } from '@genesislcap/foundation-user';
|
|
4
|
-
import { UUID, LOGIN_DETAILS_URL, LOGIN_URL, ACCEPT_TERMS_URL, LOGOUT_URL, FORGOT_PASSWORD_URL, CHANGE_PASSWORD_URL, RESET_PASSWORD_URL, } from '@genesislcap/foundation-utils';
|
|
4
|
+
import { UUID, LOGIN_DETAILS_URL, LOGIN_URL, ACCEPT_TERMS_URL, LOGOUT_URL, FORGOT_PASSWORD_URL, CHANGE_PASSWORD_URL, RESET_PASSWORD_URL, createErrorMap, } from '@genesislcap/foundation-utils';
|
|
5
5
|
import { DI } from '@microsoft/fast-foundation';
|
|
6
6
|
import { and, assign, createMachine, fromPromise, not, or, raise, sendTo } from 'xstate';
|
|
7
7
|
import { AuthConfig } from '../config/config';
|
|
@@ -122,7 +122,17 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
122
122
|
invoke: {
|
|
123
123
|
id: 'loginDetailsFetcher',
|
|
124
124
|
src: fetchMachine.machine,
|
|
125
|
-
onDone:
|
|
125
|
+
onDone: [
|
|
126
|
+
{
|
|
127
|
+
guard: 'isUnauthorizedError',
|
|
128
|
+
target: 'loggedOut',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
guard: 'isFetchError',
|
|
132
|
+
target: 'error.silentLogin',
|
|
133
|
+
},
|
|
134
|
+
this.dtoTransition(),
|
|
135
|
+
],
|
|
126
136
|
onError: [
|
|
127
137
|
{
|
|
128
138
|
guard: 'isUnauthorizedError',
|
|
@@ -146,7 +156,13 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
146
156
|
invoke: {
|
|
147
157
|
id: 'loginFetcher',
|
|
148
158
|
src: fetchMachine.machine,
|
|
149
|
-
onDone:
|
|
159
|
+
onDone: [
|
|
160
|
+
{
|
|
161
|
+
guard: 'isFetchError',
|
|
162
|
+
target: 'error.login',
|
|
163
|
+
},
|
|
164
|
+
this.dtoTransition(),
|
|
165
|
+
],
|
|
150
166
|
onError: 'error.login',
|
|
151
167
|
},
|
|
152
168
|
entry: [
|
|
@@ -205,7 +221,13 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
205
221
|
invoke: {
|
|
206
222
|
id: 'logoutFetcher',
|
|
207
223
|
src: fetchMachine.machine,
|
|
208
|
-
onDone:
|
|
224
|
+
onDone: [
|
|
225
|
+
{
|
|
226
|
+
guard: 'isFetchError',
|
|
227
|
+
target: 'error.logout',
|
|
228
|
+
},
|
|
229
|
+
this.dtoTransition(),
|
|
230
|
+
],
|
|
209
231
|
onError: 'error.logout',
|
|
210
232
|
},
|
|
211
233
|
entry: [
|
|
@@ -236,7 +258,19 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
236
258
|
invoke: {
|
|
237
259
|
id: 'forgotPasswordFetcher',
|
|
238
260
|
src: fetchMachine.machine,
|
|
239
|
-
onDone:
|
|
261
|
+
onDone: [
|
|
262
|
+
{
|
|
263
|
+
guard: 'isFetchError',
|
|
264
|
+
target: 'error.forgotPassword',
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
/**
|
|
268
|
+
* HTTP 200 NACKs are treated as success on purpose so the UI cannot
|
|
269
|
+
* reveal whether an account exists (account enumeration).
|
|
270
|
+
*/
|
|
271
|
+
target: 'feedback.forgotPassword',
|
|
272
|
+
},
|
|
273
|
+
],
|
|
240
274
|
onError: 'error.forgotPassword',
|
|
241
275
|
},
|
|
242
276
|
entry: [
|
|
@@ -257,6 +291,10 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
257
291
|
id: 'changePasswordFetcher',
|
|
258
292
|
src: fetchMachine.machine,
|
|
259
293
|
onDone: [
|
|
294
|
+
{
|
|
295
|
+
guard: 'isFetchError',
|
|
296
|
+
target: 'error.changePassword',
|
|
297
|
+
},
|
|
260
298
|
{
|
|
261
299
|
guard: 'is200NackDTO',
|
|
262
300
|
target: 'error.changePassword',
|
|
@@ -294,19 +332,29 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
294
332
|
invoke: {
|
|
295
333
|
id: 'resetPasswordFetcher',
|
|
296
334
|
src: fetchMachine.machine,
|
|
297
|
-
onDone:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
335
|
+
onDone: [
|
|
336
|
+
{
|
|
337
|
+
guard: 'isFetchError',
|
|
338
|
+
target: 'error.resetPassword',
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
guard: 'is200NackDTO',
|
|
342
|
+
target: 'error.resetPassword',
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
actions: [
|
|
346
|
+
({ context }) => {
|
|
347
|
+
const params = context.params;
|
|
348
|
+
this.cm.storeCredentials({
|
|
349
|
+
id: params.username,
|
|
350
|
+
name: params.username,
|
|
351
|
+
password: params.newPassword,
|
|
352
|
+
});
|
|
353
|
+
},
|
|
354
|
+
],
|
|
355
|
+
target: 'feedback.resetPassword',
|
|
356
|
+
},
|
|
357
|
+
],
|
|
310
358
|
onError: 'error.resetPassword',
|
|
311
359
|
},
|
|
312
360
|
entry: [
|
|
@@ -329,11 +377,17 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
329
377
|
invoke: {
|
|
330
378
|
id: 'acceptTermsFetcher',
|
|
331
379
|
src: fetchMachine.machine,
|
|
332
|
-
onDone:
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
380
|
+
onDone: [
|
|
381
|
+
{
|
|
382
|
+
guard: 'isFetchError',
|
|
383
|
+
target: '#authMachine.error.acceptTerms',
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
actions: ['refreshLogin'],
|
|
387
|
+
target: '#authMachine.idle',
|
|
388
|
+
},
|
|
389
|
+
],
|
|
390
|
+
onError: '#authMachine.error.acceptTerms',
|
|
337
391
|
},
|
|
338
392
|
entry: [
|
|
339
393
|
sendTo('acceptTermsFetcher', ({ context }) => {
|
|
@@ -465,7 +519,7 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
465
519
|
},
|
|
466
520
|
after: {
|
|
467
521
|
feedbackDelay: {
|
|
468
|
-
actions: 'loginRedirect',
|
|
522
|
+
actions: ['clearErrors', 'loginRedirect'],
|
|
469
523
|
target: '#authMachine.idle',
|
|
470
524
|
},
|
|
471
525
|
},
|
|
@@ -476,7 +530,10 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
476
530
|
content: 'MESSAGE_FORGOT_PASSWORD_RESET',
|
|
477
531
|
},
|
|
478
532
|
after: {
|
|
479
|
-
feedbackDelay:
|
|
533
|
+
feedbackDelay: {
|
|
534
|
+
actions: 'clearErrors',
|
|
535
|
+
target: '#authMachine.idle',
|
|
536
|
+
},
|
|
480
537
|
},
|
|
481
538
|
},
|
|
482
539
|
resetPassword: {
|
|
@@ -486,7 +543,7 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
486
543
|
},
|
|
487
544
|
after: {
|
|
488
545
|
feedbackDelay: {
|
|
489
|
-
actions: 'loginRedirect',
|
|
546
|
+
actions: ['clearErrors', 'loginRedirect'],
|
|
490
547
|
target: '#authMachine.idle',
|
|
491
548
|
},
|
|
492
549
|
},
|
|
@@ -552,6 +609,7 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
552
609
|
changePassword: createErrorStateNode('change-password', 'ERROR_CHANGE_PASSWORD'),
|
|
553
610
|
forgotPassword: createErrorStateNode('forgot-password', 'ERROR_FORGOT_PASSWORD'),
|
|
554
611
|
resetPassword: createErrorStateNode('reset-password', 'ERROR_RESET_PASSWORD'),
|
|
612
|
+
acceptTerms: createErrorStateNode('accept-terms', 'ERROR_ACCEPT_TERMS'),
|
|
555
613
|
logout: createErrorStateNode('logout', 'ERROR_LOGOUT_ERROR'),
|
|
556
614
|
mapping: createErrorStateNode('mapping', 'ERROR_MAPPING'),
|
|
557
615
|
},
|
|
@@ -616,7 +674,11 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
616
674
|
}
|
|
617
675
|
},
|
|
618
676
|
setError,
|
|
619
|
-
|
|
677
|
+
clearErrors: assign(() => ({
|
|
678
|
+
error: undefined,
|
|
679
|
+
errors: createErrorMap(logger.error),
|
|
680
|
+
})),
|
|
681
|
+
resetContext: assign(() => (Object.assign(Object.assign({}, this.startingContext), { errors: createErrorMap(logger.error), error: undefined }))),
|
|
620
682
|
preventSilentAccess: () => __awaiter(this, void 0, void 0, function* () {
|
|
621
683
|
yield this.cm.preventSilentAccess();
|
|
622
684
|
}),
|
|
@@ -652,7 +714,13 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
652
714
|
hasSSOToken: ({ context }) => isQueryParams(context.params) && context.params.SSO_TOKEN !== undefined,
|
|
653
715
|
hasMFACode: ({ context }) => isQueryParams(context.params) && context.params.MFA_CODE !== undefined,
|
|
654
716
|
hasWindowOpener: () => window.opener,
|
|
655
|
-
isUnauthorizedError: ({ event }) =>
|
|
717
|
+
isUnauthorizedError: ({ event }) => {
|
|
718
|
+
if (isErrorEvent(event)) {
|
|
719
|
+
return isUnauthorizedError(event.data);
|
|
720
|
+
}
|
|
721
|
+
return isDoneInvokeEvent(event) ? isUnauthorizedError(event.output) : false;
|
|
722
|
+
},
|
|
723
|
+
isFetchError: ({ event }) => isDoneInvokeEvent(event) ? event.output instanceof Error : false,
|
|
656
724
|
isAuthenticated: ({ context }) => { var _a; return (_a = context.user) === null || _a === void 0 ? void 0 : _a.isAuthenticated; },
|
|
657
725
|
isBanned: ({ context }) => { var _a; return (_a = context.user) === null || _a === void 0 ? void 0 : _a.isBanned(); },
|
|
658
726
|
isLoginAckEntity: ({ event }) => isDoneInvokeEvent(event) ? isLoginAckEntity(event.output) : false,
|
package/dist/esm/mapper/utils.js
CHANGED
|
@@ -42,9 +42,14 @@ const getNormalisedStatusCode = (arr) => {
|
|
|
42
42
|
* getNormalisedText
|
|
43
43
|
* @param arr - A NackErrorWarning array.
|
|
44
44
|
* @returns A combined text string.
|
|
45
|
+
* @remarks
|
|
46
|
+
* Joins message texts with `\n` deliberately so multi-error NACKs render as separate
|
|
47
|
+
* lines under `white-space: pre-line` (e.g. auth MessageElement). Consumers that
|
|
48
|
+
* surface `NackError.message` without a pre-line renderer (toasts, etc.) will see a
|
|
49
|
+
* literal newline where a space was used historically.
|
|
45
50
|
* @internal
|
|
46
51
|
*/
|
|
47
|
-
export const getNormalisedText = (arr) => Array.isArray(arr) && arr.length ? arr.map((msg) => msg.text).join('
|
|
52
|
+
export const getNormalisedText = (arr) => Array.isArray(arr) && arr.length ? arr.map((msg) => msg.text).join('\n') : undefined;
|
|
48
53
|
/**
|
|
49
54
|
* hasDTOErrorWarningCode
|
|
50
55
|
* @remarks
|
package/dist/esm/routes/base.js
CHANGED
|
@@ -372,7 +372,7 @@ let MessageElement = class MessageElement extends FASTElement {
|
|
|
372
372
|
const translateHelper = (metaMessage) => this.i18next.t(`${defaultAuthConfig.name}:${metaMessage}`, { lng: this.i18next.language });
|
|
373
373
|
const meta = this.store.metaMessages.map(translateHelper).join('\n');
|
|
374
374
|
const error = this.store.errorMessages.map(translateHelper).join('\n');
|
|
375
|
-
return
|
|
375
|
+
return error ? `${meta}\n${error}` : meta;
|
|
376
376
|
}
|
|
377
377
|
get hasError() {
|
|
378
378
|
return this.store.errorMessages.length > 0;
|
|
@@ -24,8 +24,17 @@ let ResetPassword = class ResetPassword extends BaseRoute {
|
|
|
24
24
|
this.passwordResetToken = '';
|
|
25
25
|
}
|
|
26
26
|
enter(phase) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
var _a, _b, _c, _d;
|
|
28
|
+
const query = ((_a = phase.route) === null || _a === void 0 ? void 0 : _a.queryParams) || {};
|
|
29
|
+
this.hasPasswordExpired = !!query.expired;
|
|
30
|
+
this.passwordResetToken = (_b = query.password) !== null && _b !== void 0 ? _b : '';
|
|
31
|
+
if (!this.hasPasswordExpired) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const username = (_d = (_c = this.store.authMachine.context.params) === null || _c === void 0 ? void 0 : _c.username) === null || _d === void 0 ? void 0 : _d.trim();
|
|
35
|
+
if (username) {
|
|
36
|
+
this.$emit('auth-username-changed', username);
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
onSubmit() {
|
|
31
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"FIELD_PASSWORD_REPEAT_NEW_TITLE": "Repeat New Password",
|
|
44
44
|
"MESSAGE_PASSWORD_CHANGE_SUCCESS": "Password change success.",
|
|
45
45
|
"MESSAGE_FORGOT_PASSWORD_RESET": "Please check your inbox for reset instructions.",
|
|
46
|
-
"MESSAGE_PASSWORD_RESET_SUCCESS": "Password reset success.",
|
|
46
|
+
"MESSAGE_PASSWORD_RESET_SUCCESS": "Password reset success. Redirecting to login.",
|
|
47
47
|
"MESSAGE_INCORRECT_CREDENTIALS": "Incorrect credentials, please try again.",
|
|
48
48
|
"MESSAGE_MFA_REQUIRED": "Please check your inbox for your login link.",
|
|
49
49
|
"MESSAGE_PASSWORD_EXPIRED": "You are required to change your password.",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"ERROR_PASSWORD_MISMATCH": "New password and confirmation must match.",
|
|
55
55
|
"ERROR_FORGOT_PASSWORD": "Forgot password error.",
|
|
56
56
|
"ERROR_RESET_PASSWORD": "Reset password error.",
|
|
57
|
+
"ERROR_ACCEPT_TERMS": "Accept terms error.",
|
|
57
58
|
"ERROR_LOGOUT_ERROR": "Logout error.",
|
|
58
59
|
"ERROR_MAPPING": "Mapping error."
|
|
59
60
|
}
|
|
@@ -1935,6 +1935,11 @@ export declare type GetCredentialOptions = CredentialRequestOptions & {};
|
|
|
1935
1935
|
* getNormalisedText
|
|
1936
1936
|
* @param arr - A NackErrorWarning array.
|
|
1937
1937
|
* @returns A combined text string.
|
|
1938
|
+
* @remarks
|
|
1939
|
+
* Joins message texts with `\n` deliberately so multi-error NACKs render as separate
|
|
1940
|
+
* lines under `white-space: pre-line` (e.g. auth MessageElement). Consumers that
|
|
1941
|
+
* surface `NackError.message` without a pre-line renderer (toasts, etc.) will see a
|
|
1942
|
+
* literal newline where a space was used historically.
|
|
1938
1943
|
* @internal
|
|
1939
1944
|
*/
|
|
1940
1945
|
export declare const getNormalisedText: (arr: NackErrorWarning[]) => string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-auth",
|
|
3
3
|
"description": "Genesis Foundation Auth",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.26.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/foundation-auth.d.ts",
|
|
@@ -134,25 +134,25 @@
|
|
|
134
134
|
}
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
|
-
"@genesislcap/foundation-testing": "15.
|
|
138
|
-
"@genesislcap/genx": "15.
|
|
139
|
-
"@genesislcap/rollup-builder": "15.
|
|
140
|
-
"@genesislcap/ts-builder": "15.
|
|
141
|
-
"@genesislcap/uvu-playwright-builder": "15.
|
|
142
|
-
"@genesislcap/vite-builder": "15.
|
|
143
|
-
"@genesislcap/webpack-builder": "15.
|
|
137
|
+
"@genesislcap/foundation-testing": "15.26.0",
|
|
138
|
+
"@genesislcap/genx": "15.26.0",
|
|
139
|
+
"@genesislcap/rollup-builder": "15.26.0",
|
|
140
|
+
"@genesislcap/ts-builder": "15.26.0",
|
|
141
|
+
"@genesislcap/uvu-playwright-builder": "15.26.0",
|
|
142
|
+
"@genesislcap/vite-builder": "15.26.0",
|
|
143
|
+
"@genesislcap/webpack-builder": "15.26.0"
|
|
144
144
|
},
|
|
145
145
|
"dependencies": {
|
|
146
|
-
"@genesislcap/foundation-comms": "15.
|
|
147
|
-
"@genesislcap/foundation-events": "15.
|
|
148
|
-
"@genesislcap/foundation-i18n": "15.
|
|
149
|
-
"@genesislcap/foundation-logger": "15.
|
|
150
|
-
"@genesislcap/foundation-state-machine": "15.
|
|
151
|
-
"@genesislcap/foundation-store": "15.
|
|
152
|
-
"@genesislcap/foundation-ui": "15.
|
|
153
|
-
"@genesislcap/foundation-user": "15.
|
|
154
|
-
"@genesislcap/foundation-utils": "15.
|
|
155
|
-
"@genesislcap/foundation-zero": "15.
|
|
146
|
+
"@genesislcap/foundation-comms": "15.26.0",
|
|
147
|
+
"@genesislcap/foundation-events": "15.26.0",
|
|
148
|
+
"@genesislcap/foundation-i18n": "15.26.0",
|
|
149
|
+
"@genesislcap/foundation-logger": "15.26.0",
|
|
150
|
+
"@genesislcap/foundation-state-machine": "15.26.0",
|
|
151
|
+
"@genesislcap/foundation-store": "15.26.0",
|
|
152
|
+
"@genesislcap/foundation-ui": "15.26.0",
|
|
153
|
+
"@genesislcap/foundation-user": "15.26.0",
|
|
154
|
+
"@genesislcap/foundation-utils": "15.26.0",
|
|
155
|
+
"@genesislcap/foundation-zero": "15.26.0",
|
|
156
156
|
"@microsoft/fast-components": "2.30.6",
|
|
157
157
|
"@microsoft/fast-element": "1.14.0",
|
|
158
158
|
"@microsoft/fast-foundation": "2.50.0",
|