@genesislcap/foundation-login 14.70.4-es2021.1 → 14.70.4-test.1
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/esm/components/components.js +23 -18
- package/dist/esm/main/config.js +1 -4
- package/dist/esm/main/main.definition.js +2 -8
- package/dist/esm/main/main.js +30 -30
- package/dist/esm/routes/base.js +69 -59
- package/dist/esm/routes/config.js +4 -4
- package/dist/esm/routes/forgot-password/forgot-password.js +23 -13
- package/dist/esm/routes/login-form/login-form.js +90 -68
- package/dist/esm/routes/protected/protected.js +10 -8
- package/dist/esm/routes/request-account/request-account.js +9 -4
- package/dist/esm/routes/reset-password/reset-password.js +39 -23
- package/dist/esm/routes/verify/verify.js +9 -4
- package/dist/esm/utils/sso.js +3 -2
- package/package.json +8 -8
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
import { FoundationRouter } from '@genesislcap/foundation-ui';
|
|
2
3
|
import { logger } from '../utils';
|
|
3
4
|
var ResourceType;
|
|
@@ -16,25 +17,29 @@ function loadZeroFallback() {
|
|
|
16
17
|
/**
|
|
17
18
|
* Granular
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
function loadZeroDesignSystem() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
let type = ResourceType.REMOTE;
|
|
23
|
+
try {
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
return yield import('foundationZero/ZeroDesignSystem');
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
type = ResourceType.LOCAL;
|
|
29
|
+
return yield loadZeroFallback();
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
logger.debug(`Using '${type}' version of foundationZero/ZeroDesignSystem`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
32
35
|
}
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
export function loadRemotes(options) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const { registerZeroDesignSystem } = yield loadZeroDesignSystem();
|
|
39
|
+
return {
|
|
40
|
+
ZeroDesignSystem: registerZeroDesignSystem(),
|
|
41
|
+
};
|
|
42
|
+
});
|
|
38
43
|
}
|
|
39
44
|
/**
|
|
40
45
|
* Ensure tree shaking doesn't remove these
|
package/dist/esm/main/config.js
CHANGED
|
@@ -151,8 +151,5 @@ export const LoginConfig = DI.createInterface();
|
|
|
151
151
|
* We can tailor the spreading logic after we put it to use. Keeping it simple for now.
|
|
152
152
|
*/
|
|
153
153
|
export function configure(container, config) {
|
|
154
|
-
container.register(Registration.instance(LoginConfig, {
|
|
155
|
-
...defaultLoginConfig,
|
|
156
|
-
...config,
|
|
157
|
-
}));
|
|
154
|
+
container.register(Registration.instance(LoginConfig, Object.assign(Object.assign({}, defaultLoginConfig), config)));
|
|
158
155
|
}
|
|
@@ -38,12 +38,6 @@ export const definition = {
|
|
|
38
38
|
*/
|
|
39
39
|
export const standaloneDefinition = {
|
|
40
40
|
name: 'foundation-login',
|
|
41
|
-
template: template({
|
|
42
|
-
|
|
43
|
-
provider: 'zero-design-system-provider',
|
|
44
|
-
}),
|
|
45
|
-
styles: styles({
|
|
46
|
-
...defaultTemplateOptions,
|
|
47
|
-
provider: 'zero-design-system-provider',
|
|
48
|
-
}),
|
|
41
|
+
template: template(Object.assign(Object.assign({}, defaultTemplateOptions), { provider: 'zero-design-system-provider' })),
|
|
42
|
+
styles: styles(Object.assign(Object.assign({}, defaultTemplateOptions), { provider: 'zero-design-system-provider' })),
|
|
49
43
|
};
|
package/dist/esm/main/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { ConnectConfig, defaultConnectConfig, Session } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { customElement, FASTElement, observable } from '@microsoft/fast-element';
|
|
4
4
|
import { Container, inject, Registration } from '@microsoft/fast-foundation';
|
|
@@ -118,11 +118,16 @@ let Login = class Login extends FASTElement {
|
|
|
118
118
|
/**
|
|
119
119
|
* @internal
|
|
120
120
|
*/
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this
|
|
121
|
+
connectedCallback() {
|
|
122
|
+
const _super = Object.create(null, {
|
|
123
|
+
connectedCallback: { get: () => super.connectedCallback }
|
|
124
|
+
});
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
this.registerDIDependencies();
|
|
127
|
+
_super.connectedCallback.call(this);
|
|
128
|
+
yield this.registerCommonComponents();
|
|
129
|
+
this.checkForSSOToken();
|
|
130
|
+
});
|
|
126
131
|
}
|
|
127
132
|
/**
|
|
128
133
|
* Used to forward the user onto a logged-in session during an SSO journey
|
|
@@ -164,17 +169,19 @@ let Login = class Login extends FASTElement {
|
|
|
164
169
|
* Called from the connectedCallback
|
|
165
170
|
* @internal
|
|
166
171
|
*/
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
registerCommonComponents() {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
/**
|
|
175
|
+
* Send event to indicate some async work is happening. Will be picked up by overlay micro frontend.
|
|
176
|
+
*/
|
|
177
|
+
yield Components.loadRemotes({});
|
|
178
|
+
/**
|
|
179
|
+
* Simulate loading delay, TODO: Remove
|
|
180
|
+
*
|
|
181
|
+
* await new Promise(resolve => setTimeout(resolve, 3000));
|
|
182
|
+
*/
|
|
183
|
+
this.ready = true;
|
|
184
|
+
});
|
|
178
185
|
}
|
|
179
186
|
/**
|
|
180
187
|
* @internal
|
|
@@ -185,13 +192,7 @@ let Login = class Login extends FASTElement {
|
|
|
185
192
|
* Register custom configs for core services. Note this can also be done via provideDesignSystem().register(...)
|
|
186
193
|
* if preferred. Here for example mainly as this will mostly occur at an app level.
|
|
187
194
|
*/
|
|
188
|
-
Registration.instance(ConnectConfig, {
|
|
189
|
-
...defaultConnectConfig,
|
|
190
|
-
connect: {
|
|
191
|
-
...defaultConnectConfig.connect,
|
|
192
|
-
heartbeatInterval: 12000,
|
|
193
|
-
},
|
|
194
|
-
}));
|
|
195
|
+
Registration.instance(ConnectConfig, Object.assign(Object.assign({}, defaultConnectConfig), { connect: Object.assign(Object.assign({}, defaultConnectConfig.connect), { heartbeatInterval: 12000 }) })));
|
|
195
196
|
}
|
|
196
197
|
};
|
|
197
198
|
__decorate([
|
|
@@ -220,14 +221,13 @@ export { Login };
|
|
|
220
221
|
* customise the MF for their needs via define.ts.
|
|
221
222
|
*/
|
|
222
223
|
let LoginHosted = class LoginHosted extends Login {
|
|
223
|
-
|
|
224
|
-
this
|
|
224
|
+
registerCommonComponents() {
|
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
this.ready = true;
|
|
227
|
+
});
|
|
225
228
|
}
|
|
226
229
|
};
|
|
227
230
|
LoginHosted = __decorate([
|
|
228
|
-
customElement({
|
|
229
|
-
...definition,
|
|
230
|
-
name: `${definition.name}-hosted`,
|
|
231
|
-
})
|
|
231
|
+
customElement(Object.assign(Object.assign({}, definition), { name: `${definition.name}-hosted` }))
|
|
232
232
|
], LoginHosted);
|
|
233
233
|
export { LoginHosted };
|
package/dist/esm/routes/base.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { Auth, Connect, CredentialManager, credentialSeparator, MessageBuilder, Session, } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { sync } from '@genesislcap/foundation-utils';
|
|
4
4
|
import { SecondaryRapidColorHEX } from '@genesislcap/foundation-zero';
|
|
@@ -52,8 +52,9 @@ export class BaseRoute extends ConfigHostElement {
|
|
|
52
52
|
this.onNavigate = (path) => Route.path.push(path);
|
|
53
53
|
}
|
|
54
54
|
connectedCallback() {
|
|
55
|
+
var _a;
|
|
55
56
|
super.connectedCallback();
|
|
56
|
-
this.host = this.session.getSessionStorageItem('hostUrl')
|
|
57
|
+
this.host = (_a = this.session.getSessionStorageItem('hostUrl')) !== null && _a !== void 0 ? _a : hostUrl;
|
|
57
58
|
/**
|
|
58
59
|
* Fill with default values from config / env vars if needed.
|
|
59
60
|
* For now using CredentialManager based auto-filling.
|
|
@@ -64,16 +65,20 @@ export class BaseRoute extends ConfigHostElement {
|
|
|
64
65
|
// this.email = this.config.fields.email?.value;
|
|
65
66
|
// this.password = this.config.fields.password?.value;
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
this
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
onSubmit() {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
this.isSubmitting = true;
|
|
71
|
+
this.clearError();
|
|
72
|
+
yield this.ensureConnection();
|
|
73
|
+
});
|
|
71
74
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
ensureConnection() {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
if (this.connect.isConnected) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return this.connect.connect(this.host);
|
|
81
|
+
});
|
|
77
82
|
}
|
|
78
83
|
setError(message) {
|
|
79
84
|
this.message = message;
|
|
@@ -96,42 +101,45 @@ export class BaseRoute extends ConfigHostElement {
|
|
|
96
101
|
this.onBack();
|
|
97
102
|
}, delay);
|
|
98
103
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* Neptune was using cookies directly. To provide them with a seamless upgrade, we should load from cookies if the
|
|
105
|
-
* container is empty. These stored cookies become irrelevant after their first login in the new system.
|
|
106
|
-
*/
|
|
107
|
-
const containerData = await this.credentialManager.getCredentialsFromContainer();
|
|
108
|
-
const cookieData = await this.credentialManager.getCredentialsFromCookie();
|
|
109
|
-
const [normalisedData, canRemoveCookie] = this.credentialManager.normaliseLegacyCredentialData(containerData, cookieData);
|
|
110
|
-
if (cookieData && canRemoveCookie) {
|
|
104
|
+
autofill() {
|
|
105
|
+
var _a, _b, _c;
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
let credentialData;
|
|
108
|
+
try {
|
|
111
109
|
/**
|
|
112
|
-
*
|
|
110
|
+
* TODO: Revert back to `credentialManager.getCredentials()` after Neptune deployment.
|
|
111
|
+
* Neptune was using cookies directly. To provide them with a seamless upgrade, we should load from cookies if the
|
|
112
|
+
* container is empty. These stored cookies become irrelevant after their first login in the new system.
|
|
113
113
|
*/
|
|
114
|
-
this.credentialManager.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
const containerData = yield this.credentialManager.getCredentialsFromContainer();
|
|
115
|
+
const cookieData = yield this.credentialManager.getCredentialsFromCookie();
|
|
116
|
+
const [normalisedData, canRemoveCookie] = this.credentialManager.normaliseLegacyCredentialData(containerData, cookieData);
|
|
117
|
+
if (cookieData && canRemoveCookie) {
|
|
118
|
+
/**
|
|
119
|
+
* Upgrade path: They have chosen a profile from the container, yet also have a cookie... it's safe to remove the cookie.
|
|
120
|
+
*/
|
|
121
|
+
this.credentialManager.removeCookie();
|
|
122
|
+
}
|
|
123
|
+
credentialData = normalisedData;
|
|
124
|
+
if (credentialData) {
|
|
125
|
+
this.username = (_a = credentialData.name) !== null && _a !== void 0 ? _a : '';
|
|
126
|
+
this.password = (_b = credentialData.password) !== null && _b !== void 0 ? _b : '';
|
|
127
|
+
if (this.config.fields.organisation) {
|
|
128
|
+
const combinedCompIdUsername = (_c = credentialData.id) !== null && _c !== void 0 ? _c : '';
|
|
129
|
+
const valueParts = combinedCompIdUsername.split(credentialSeparator);
|
|
130
|
+
const orgIdx = valueParts.length === 2 ? 1 : 0;
|
|
131
|
+
const proposedOrganisation = valueParts[orgIdx];
|
|
132
|
+
if (proposedOrganisation !== this.username) {
|
|
133
|
+
this.organisation = proposedOrganisation;
|
|
134
|
+
}
|
|
127
135
|
}
|
|
128
136
|
}
|
|
129
137
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
catch (err) {
|
|
139
|
+
logger.error('An error occurred attempting to get and autofill from stored credentials.', err);
|
|
140
|
+
}
|
|
141
|
+
return Promise.resolve(!!credentialData);
|
|
142
|
+
});
|
|
135
143
|
}
|
|
136
144
|
storeCredentials(password = this.password) {
|
|
137
145
|
this.credentialManager.storeCredentials({
|
|
@@ -140,17 +148,19 @@ export class BaseRoute extends ConfigHostElement {
|
|
|
140
148
|
password,
|
|
141
149
|
});
|
|
142
150
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
sendMessage(message, successFeedback = '', successCallback) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
yield this.ensureConnection();
|
|
154
|
+
this.clearError();
|
|
155
|
+
const result = yield this.connect.send(message);
|
|
156
|
+
if (result.ERROR) {
|
|
157
|
+
this.setError(result.ERROR.map((error) => error.TEXT).toString());
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.message = successFeedback;
|
|
161
|
+
successCallback && successCallback(result);
|
|
162
|
+
this.queueOnBack();
|
|
163
|
+
});
|
|
154
164
|
}
|
|
155
165
|
}
|
|
156
166
|
__decorate([
|
|
@@ -217,11 +227,11 @@ export const configurableTextField = (name, type, autofocus = false, autocomplet
|
|
|
217
227
|
?autofocus="${() => autofocus}"
|
|
218
228
|
?required="${() => required}"
|
|
219
229
|
${autocomplete ? `autocomplete="${autocomplete}"` : ''}
|
|
220
|
-
data-test-id="${testIdOverride
|
|
230
|
+
data-test-id="${testIdOverride !== null && testIdOverride !== void 0 ? testIdOverride : fieldName}"
|
|
221
231
|
class="${className}"
|
|
222
232
|
>
|
|
223
233
|
<span class="form-title">
|
|
224
|
-
${(x) => labelOverride
|
|
234
|
+
${(x) => labelOverride !== null && labelOverride !== void 0 ? labelOverride : x.config.fields[fieldName].label}
|
|
225
235
|
</span>
|
|
226
236
|
</zero-text-field>
|
|
227
237
|
`)}
|
|
@@ -244,7 +254,7 @@ export const organisationField = () => html `
|
|
|
244
254
|
?required="${(x) => (x.config.fields.organisation.required === false ? false : true)}"
|
|
245
255
|
>
|
|
246
256
|
<span class="form-title">
|
|
247
|
-
${(x) => x.config.fields.organisation.label
|
|
257
|
+
${(x) => { var _a; return (_a = x.config.fields.organisation.label) !== null && _a !== void 0 ? _a : 'Organisation'; }}
|
|
248
258
|
</span>
|
|
249
259
|
</zero-text-field>
|
|
250
260
|
`)}
|
|
@@ -266,7 +276,7 @@ export const usernameField = () => html `
|
|
|
266
276
|
title="${(x) => x.config.fields.username.title}"
|
|
267
277
|
required
|
|
268
278
|
>
|
|
269
|
-
<span class="form-title">${(x) => x.config.fields.username.label
|
|
279
|
+
<span class="form-title">${(x) => { var _a; return (_a = x.config.fields.username.label) !== null && _a !== void 0 ? _a : 'Username'; }}</span>
|
|
270
280
|
</zero-text-field>
|
|
271
281
|
`;
|
|
272
282
|
/**
|
|
@@ -283,7 +293,7 @@ export const emailField = () => html `
|
|
|
283
293
|
:value="${sync((x) => x.email)}"
|
|
284
294
|
required
|
|
285
295
|
>
|
|
286
|
-
<span class="form-title">${(x) => x.config.fields.email.label
|
|
296
|
+
<span class="form-title">${(x) => { var _a; return (_a = x.config.fields.email.label) !== null && _a !== void 0 ? _a : 'Email'; }}</span>
|
|
287
297
|
</zero-text-field>
|
|
288
298
|
`)}
|
|
289
299
|
`;
|
|
@@ -300,7 +310,7 @@ export const passwordField = (label) => html `
|
|
|
300
310
|
:value="${sync((x) => x.password)}"
|
|
301
311
|
required
|
|
302
312
|
>
|
|
303
|
-
<span class="form-title">${(x) => label
|
|
313
|
+
<span class="form-title">${(x) => { var _a; return (_a = label !== null && label !== void 0 ? label : x.config.fields.password.label) !== null && _a !== void 0 ? _a : 'Password'; }}</span>
|
|
304
314
|
</zero-text-field>
|
|
305
315
|
`;
|
|
306
316
|
const password2FieldMeta = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate, __param } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate, __param } from "tslib";
|
|
2
2
|
import { Auth, Session, FoundationAnalytics, FoundationAnalyticsEventType, } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { Container, optional } from '@microsoft/fast-foundation';
|
|
4
4
|
import { RouterConfiguration, Route } from '@microsoft/fast-router';
|
|
@@ -117,7 +117,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
117
117
|
* Example of a NavigationContributor
|
|
118
118
|
*/
|
|
119
119
|
this.contributors.push({
|
|
120
|
-
navigate:
|
|
120
|
+
navigate: (phase) => __awaiter(this, void 0, void 0, function* () {
|
|
121
121
|
const settings = phase.route.settings;
|
|
122
122
|
/**
|
|
123
123
|
* TODO: Centralise
|
|
@@ -141,7 +141,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
141
141
|
/**
|
|
142
142
|
* If allowAutoAuth and session is valid try to connect+auto-login
|
|
143
143
|
*/
|
|
144
|
-
if (this.loginConfig.autoAuth && (
|
|
144
|
+
if (this.loginConfig.autoAuth && (yield auth.reAuthFromSession())) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
@@ -151,7 +151,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
151
151
|
session.captureReturnUrl();
|
|
152
152
|
Route.name.replace(phase.router, 'login');
|
|
153
153
|
});
|
|
154
|
-
},
|
|
154
|
+
}),
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
construct(Type) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { customElement } from '@microsoft/fast-element';
|
|
3
3
|
import { hostEnv } from '../../main/config';
|
|
4
4
|
import { commonLoginRouteStyles } from '../../styles';
|
|
@@ -6,19 +6,29 @@ import { logger } from '../../utils';
|
|
|
6
6
|
import { BaseRoute } from '../base';
|
|
7
7
|
import { ForgotPasswordTemplate as template } from './forgot-password.template';
|
|
8
8
|
let ForgotPassword = class ForgotPassword extends BaseRoute {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
const _super = Object.create(null, {
|
|
11
|
+
connectedCallback: { get: () => super.connectedCallback }
|
|
12
|
+
});
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
_super.connectedCallback.call(this);
|
|
15
|
+
yield this.autofill();
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
onSubmit() {
|
|
19
|
+
const _super = Object.create(null, {
|
|
20
|
+
onSubmit: { get: () => super.onSubmit }
|
|
21
|
+
});
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
logger.debug('forgot password submission');
|
|
24
|
+
yield _super.onSubmit.call(this);
|
|
25
|
+
/**
|
|
26
|
+
* Example url from email: https://public-foundation.genesislab.global/reset-password?password=nc_cbGrlgCkZeJHAF043oqEidnk
|
|
27
|
+
*/
|
|
28
|
+
const returnUrl = `${location.protocol}//${hostEnv}/${this.getSubRoutePath('reset-password')}`;
|
|
29
|
+
const message = this.messageBuilder.createForgotPasswordMessage(this.orgUsername, returnUrl);
|
|
30
|
+
yield this.sendMessage(message, 'Please check your inbox for reset instructions.');
|
|
31
|
+
});
|
|
22
32
|
}
|
|
23
33
|
};
|
|
24
34
|
ForgotPassword = __decorate([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { AuthError } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { inIFrame, inSymphonyDesktop, openPopup } from '@genesislcap/foundation-utils';
|
|
4
4
|
import { customElement, DOM, observable, volatile } from '@microsoft/fast-element';
|
|
@@ -20,40 +20,50 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
20
20
|
this.convertHostUrl();
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
const _super = Object.create(null, {
|
|
25
|
+
connectedCallback: { get: () => super.connectedCallback }
|
|
26
|
+
});
|
|
27
|
+
var _a, _b;
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
_super.connectedCallback.call(this);
|
|
30
|
+
this.ssoToggled = (_b = (_a = this.config.sso) === null || _a === void 0 ? void 0 : _a.toggled) !== null && _b !== void 0 ? _b : false;
|
|
31
|
+
if (this.connect.isConnected && this.auth.isLoggedIn) {
|
|
32
|
+
yield this.credentialManager.preventSilentAccess();
|
|
33
|
+
yield this.auth.logout();
|
|
34
|
+
}
|
|
35
|
+
this.convertHostUrl();
|
|
36
|
+
if (!this.ssoToggled) {
|
|
37
|
+
yield this.autofill();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
34
40
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
enter() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
DOM.queueUpdate(() => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
try {
|
|
45
|
+
if (!this.connect.isConnected && this.config.autoConnect) {
|
|
46
|
+
yield this.toggleConnection();
|
|
47
|
+
}
|
|
48
|
+
if (!this.auth.isLoggedIn && this.config.autoAuth) {
|
|
49
|
+
this.attemptLoginWhenConnected();
|
|
50
|
+
}
|
|
40
51
|
}
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
catch (e) {
|
|
53
|
+
logger.debug(e);
|
|
43
54
|
}
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
logger.debug(e);
|
|
47
|
-
}
|
|
55
|
+
}));
|
|
48
56
|
});
|
|
49
57
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.connect.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
toggleConnection() {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
if (this.connect.isConnected) {
|
|
61
|
+
this.connect.disconnect();
|
|
62
|
+
logger.debug(`Disconnected from ${this.host}`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
return this.connect.connect(this.host);
|
|
66
|
+
});
|
|
57
67
|
}
|
|
58
68
|
attemptLoginWhenConnected() {
|
|
59
69
|
this.connect.isConnectedSubject.subscribe((isConnected) => {
|
|
@@ -95,14 +105,16 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
95
105
|
this.login(basicCredentials);
|
|
96
106
|
}
|
|
97
107
|
ssoToggledChanged() {
|
|
108
|
+
var _a, _b;
|
|
98
109
|
this.clearError();
|
|
99
110
|
if (this.ssoToggled) {
|
|
100
|
-
const path = `${this.config.sso
|
|
111
|
+
const path = `${(_b = (_a = this.config.sso) === null || _a === void 0 ? void 0 : _a.identityProvidersPath) !== null && _b !== void 0 ? _b : 'sso/list'}`;
|
|
101
112
|
fetchIDPs(path)
|
|
102
113
|
.then((idps) => {
|
|
114
|
+
var _a, _b;
|
|
103
115
|
logger.debug('fetched IDPs', idps);
|
|
104
116
|
this.idps = idps;
|
|
105
|
-
this.selectedIDP = this
|
|
117
|
+
this.selectedIDP = (_b = (_a = this === null || this === void 0 ? void 0 : this.idps) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
106
118
|
})
|
|
107
119
|
.catch(() => this.setError('Failed to fetch identity providers.'));
|
|
108
120
|
}
|
|
@@ -128,54 +140,64 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
128
140
|
}
|
|
129
141
|
}
|
|
130
142
|
convertHostUrl() {
|
|
131
|
-
|
|
143
|
+
var _a, _b, _c, _d;
|
|
144
|
+
if (((_a = this.connect) === null || _a === void 0 ? void 0 : _a.httpMode()) && ((_b = this.host) === null || _b === void 0 ? void 0 : _b.startsWith('ws'))) {
|
|
132
145
|
this.host = this.host.replace('ws', 'http');
|
|
133
146
|
}
|
|
134
|
-
else if (!this.connect
|
|
147
|
+
else if (!((_c = this.connect) === null || _c === void 0 ? void 0 : _c.httpMode()) && ((_d = this.host) === null || _d === void 0 ? void 0 : _d.startsWith('http'))) {
|
|
135
148
|
this.host = this.host.replace('http', 'ws');
|
|
136
149
|
}
|
|
137
150
|
}
|
|
138
|
-
|
|
139
|
-
|
|
151
|
+
onHostSubmit() {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
yield this.toggleConnection();
|
|
154
|
+
});
|
|
140
155
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
156
|
+
onLoginSubmit() {
|
|
157
|
+
const _super = Object.create(null, {
|
|
158
|
+
onSubmit: { get: () => super.onSubmit }
|
|
159
|
+
});
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
yield _super.onSubmit.call(this);
|
|
162
|
+
DOM.queueUpdate(() => {
|
|
163
|
+
this.attemptBasicLogin();
|
|
164
|
+
});
|
|
145
165
|
});
|
|
146
166
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
Route.path.push(url);
|
|
160
|
-
}
|
|
161
|
-
catch (err) {
|
|
162
|
-
if (err instanceof AuthError) {
|
|
163
|
-
if (err.hasPasswordExpiredError()) {
|
|
164
|
-
this.storeCredentials();
|
|
165
|
-
this.onNavigate(this.getSubRoutePath('reset-password?expired'));
|
|
166
|
-
return;
|
|
167
|
+
login(credentials) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
try {
|
|
170
|
+
const { authToken } = yield this.auth.login(credentials);
|
|
171
|
+
if (!authToken) {
|
|
172
|
+
throw new Error('Unable to login. Try again later.');
|
|
173
|
+
}
|
|
174
|
+
this.storeCredentials();
|
|
175
|
+
let url = this.config.defaultRedirectUrl;
|
|
176
|
+
if (this.session.returnUrl &&
|
|
177
|
+
!this.config.omitRedirectUrls.includes(this.session.returnUrl)) {
|
|
178
|
+
url = this.session.returnUrl;
|
|
167
179
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
180
|
+
Route.path.push(url);
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
if (err instanceof AuthError) {
|
|
184
|
+
if (err.hasPasswordExpiredError()) {
|
|
185
|
+
this.storeCredentials();
|
|
186
|
+
this.onNavigate(this.getSubRoutePath('reset-password?expired'));
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (this.config.fields.organisation &&
|
|
190
|
+
this.config.fields.organisation.required !== false &&
|
|
191
|
+
!this.organisation.length) {
|
|
192
|
+
this.setError(err.message + 'Please fill in Comp Id.');
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.setError(err.message + err.getMessageError());
|
|
172
196
|
return;
|
|
173
197
|
}
|
|
174
|
-
this.setError(err.message
|
|
175
|
-
return;
|
|
198
|
+
this.setError(err.message);
|
|
176
199
|
}
|
|
177
|
-
|
|
178
|
-
}
|
|
200
|
+
});
|
|
179
201
|
}
|
|
180
202
|
get connectActionText() {
|
|
181
203
|
return this.connect.isConnected ? 'Disconnect' : 'Connect';
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { customElement } from '@microsoft/fast-element';
|
|
3
3
|
import { commonLoginRouteStyles } from '../../styles';
|
|
4
4
|
import { BaseRoute } from '../base';
|
|
5
5
|
import { ProtectedTemplate as template } from './protected.template';
|
|
6
6
|
let Protected = class Protected extends BaseRoute {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
onLogout() {
|
|
8
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const result = yield this.auth.logout();
|
|
10
|
+
if (!result.success) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
yield this.credentialManager.preventSilentAccess();
|
|
14
|
+
this.onNavigate('/');
|
|
15
|
+
});
|
|
14
16
|
}
|
|
15
17
|
};
|
|
16
18
|
Protected = __decorate([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { customElement, observable } from '@microsoft/fast-element';
|
|
3
3
|
import { commonLoginRouteStyles } from '../../styles';
|
|
4
4
|
import { logger } from '../../utils';
|
|
@@ -9,9 +9,14 @@ let RequestAccount = class RequestAccount extends BaseRoute {
|
|
|
9
9
|
super(...arguments);
|
|
10
10
|
this.termsAgreed = false;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
onSubmit() {
|
|
13
|
+
const _super = Object.create(null, {
|
|
14
|
+
onSubmit: { get: () => super.onSubmit }
|
|
15
|
+
});
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
logger.debug('request account submission');
|
|
18
|
+
yield _super.onSubmit.call(this);
|
|
19
|
+
});
|
|
15
20
|
}
|
|
16
21
|
};
|
|
17
22
|
__decorate([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { customElement, observable, volatile } from '@microsoft/fast-element';
|
|
3
3
|
import { commonLoginRouteStyles } from '../../styles';
|
|
4
4
|
import { logger } from '../../utils';
|
|
@@ -10,33 +10,49 @@ let ResetPassword = class ResetPassword extends BaseRoute {
|
|
|
10
10
|
this.hasPasswordExpired = false;
|
|
11
11
|
this.passwordResetToken = '';
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
const _super = Object.create(null, {
|
|
15
|
+
connectedCallback: { get: () => super.connectedCallback }
|
|
16
|
+
});
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
_super.connectedCallback.call(this);
|
|
19
|
+
yield this.autofill();
|
|
20
|
+
});
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
this
|
|
19
|
-
|
|
22
|
+
enter(phase) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
this.hasPasswordExpired = !!phase.route.queryParams.expired;
|
|
25
|
+
this.passwordResetToken = phase.route.queryParams.password;
|
|
26
|
+
});
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
onSubmit() {
|
|
29
|
+
const _super = Object.create(null, {
|
|
30
|
+
onSubmit: { get: () => super.onSubmit }
|
|
31
|
+
});
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
yield _super.onSubmit.call(this);
|
|
34
|
+
this.passwordResetToken
|
|
35
|
+
? yield this.onForgotPasswordWorkflow()
|
|
36
|
+
: yield this.onChangePasswordWorkflow();
|
|
37
|
+
this.isSubmitting = false;
|
|
38
|
+
});
|
|
27
39
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.
|
|
40
|
+
onForgotPasswordWorkflow() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
logger.debug('forgot password submission');
|
|
43
|
+
const message = this.messageBuilder.createForgotPasswordTokenMessage(this.orgUsername, this.passwordResetToken, this.password2);
|
|
44
|
+
yield this.sendMessage(message, 'Password reset success.', () => {
|
|
45
|
+
this.storeCredentials(this.password2);
|
|
46
|
+
});
|
|
33
47
|
});
|
|
34
48
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
49
|
+
onChangePasswordWorkflow() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
logger.debug('change password submission');
|
|
52
|
+
const message = this.messageBuilder.createChangePasswordMessage(this.orgUsername, this.password, this.password2);
|
|
53
|
+
yield this.sendMessage(message, 'Password change success.', () => {
|
|
54
|
+
this.storeCredentials(this.password2);
|
|
55
|
+
});
|
|
40
56
|
});
|
|
41
57
|
}
|
|
42
58
|
get headingText() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { customElement, observable } from '@microsoft/fast-element';
|
|
3
3
|
import { commonLoginRouteStyles } from '../../styles';
|
|
4
4
|
import { logger } from '../../utils';
|
|
@@ -9,9 +9,14 @@ let Verify = class Verify extends BaseRoute {
|
|
|
9
9
|
super(...arguments);
|
|
10
10
|
this.code = '';
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
onSubmit() {
|
|
13
|
+
const _super = Object.create(null, {
|
|
14
|
+
onSubmit: { get: () => super.onSubmit }
|
|
15
|
+
});
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
logger.debug('2FA verify submission');
|
|
18
|
+
yield _super.onSubmit.call(this);
|
|
19
|
+
});
|
|
15
20
|
}
|
|
16
21
|
};
|
|
17
22
|
__decorate([
|
package/dist/esm/utils/sso.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
import { API_HOST } from '@genesislcap/foundation-utils';
|
|
2
3
|
import { logger } from './logger';
|
|
3
4
|
/**
|
|
@@ -29,7 +30,7 @@ export const getSSOLoginURL = (idp, path = '/login?idp=', host = API_HOST) => {
|
|
|
29
30
|
*
|
|
30
31
|
* @public
|
|
31
32
|
*/
|
|
32
|
-
export const fetchIDPs =
|
|
33
|
+
export const fetchIDPs = (path = 'sso/list', host = API_HOST) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
34
|
const IDP_ENDPOINT = getIPDEndpoint(path, host);
|
|
34
35
|
return fetch(IDP_ENDPOINT)
|
|
35
36
|
.then((res) => {
|
|
@@ -46,4 +47,4 @@ export const fetchIDPs = async (path = 'sso/list', host = API_HOST) => {
|
|
|
46
47
|
logger.error('Failed to fetch identity providers.');
|
|
47
48
|
return [{ id: 'error', type: null, description: 'Failed to fetch providers.' }];
|
|
48
49
|
});
|
|
49
|
-
};
|
|
50
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-login",
|
|
3
3
|
"description": "Genesis Foundation Login",
|
|
4
|
-
"version": "14.70.4-
|
|
4
|
+
"version": "14.70.4-test.1",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/foundation-login.d.ts",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"test:debug": "genx test --debug"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@genesislcap/foundation-testing": "14.70.4-
|
|
53
|
-
"@genesislcap/genx": "14.70.4-
|
|
52
|
+
"@genesislcap/foundation-testing": "14.70.4-test.1",
|
|
53
|
+
"@genesislcap/genx": "14.70.4-test.1",
|
|
54
54
|
"rimraf": "^3.0.2"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@genesislcap/foundation-comms": "14.70.4-
|
|
58
|
-
"@genesislcap/foundation-ui": "14.70.4-
|
|
59
|
-
"@genesislcap/foundation-utils": "14.70.4-
|
|
60
|
-
"@genesislcap/foundation-zero": "14.70.4-
|
|
57
|
+
"@genesislcap/foundation-comms": "14.70.4-test.1",
|
|
58
|
+
"@genesislcap/foundation-ui": "14.70.4-test.1",
|
|
59
|
+
"@genesislcap/foundation-utils": "14.70.4-test.1",
|
|
60
|
+
"@genesislcap/foundation-zero": "14.70.4-test.1",
|
|
61
61
|
"@microsoft/fast-components": "^2.21.3",
|
|
62
62
|
"@microsoft/fast-element": "^1.7.0",
|
|
63
63
|
"@microsoft/fast-foundation": "^2.33.2",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
76
|
"customElements": "dist/custom-elements.json",
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "2414c66a7a84c61343d756e240cb4140d82f1311"
|
|
78
78
|
}
|