@genesislcap/foundation-login 14.77.2 → 14.78.0-mfa-auth.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"login-form.d.ts","sourceRoot":"","sources":["../../../../src/routes/login-form/login-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAKpE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAI/B,qBAKa,SAAU,SAAQ,SAAS;IAC1B,IAAI,EAAE,GAAG,EAAE,CAAM;IACjB,WAAW,EAAE,MAAM,CAAM;IACzB,UAAU,EAAE,OAAO,CAAS;IAElC,iBAAiB;IAejB,KAAK;IAeL,gBAAgB,IAAI,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAStD,OAAO,CAAC,yBAAyB;IA8BjC,OAAO,CAAC,iBAAiB;IAczB,iBAAiB;IAmBjB,IACI,eAAe,WAElB;IAED,cAAc,MAAO,WAAW,KAAG,IAAI,CAIrC;IAEF,UAAU;IAiBV,OAAO,CAAC,cAAc;IAQhB,YAAY;IAIZ,aAAa;IAOb,KAAK,CAAC,WAAW,EAAE,QAAQ;IAqCjC,IACI,iBAAiB,6BAEpB;IAED,IAAI,qBAAqB,YAExB;IAED,IAAI,cAAc,YAEjB;CACF"}
1
+ {"version":3,"file":"login-form.d.ts","sourceRoot":"","sources":["../../../../src/routes/login-form/login-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAKpE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAI/B,qBAKa,SAAU,SAAQ,SAAS;IAC1B,IAAI,EAAE,GAAG,EAAE,CAAM;IACjB,WAAW,EAAE,MAAM,CAAM;IACzB,UAAU,EAAE,OAAO,CAAS;IAElC,iBAAiB;IAejB,KAAK;IAqBL,gBAAgB,IAAI,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAStD,OAAO,CAAC,yBAAyB;IAiDjC,OAAO,CAAC,iBAAiB;IAkBzB,iBAAiB;IAmBjB,IACI,eAAe,WAElB;IAED,cAAc,MAAO,WAAW,KAAG,IAAI,CAIrC;IAEF,UAAU;IAiBV,OAAO,CAAC,cAAc;IAQhB,YAAY;IAIZ,aAAa;IAOb,KAAK,CAAC,WAAW,EAAE,QAAQ;IAyCjC,IACI,iBAAiB,6BAEpB;IAED,IAAI,qBAAqB,YAExB;IAED,IAAI,cAAc,YAEjB;CACF"}
@@ -40,6 +40,11 @@ let LoginForm = class LoginForm extends BaseRoute {
40
40
  }
41
41
  enter() {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
+ const queryParams = new URLSearchParams(window.location.search);
44
+ const mfaCode = queryParams.get('MFA_CODE');
45
+ if (mfaCode) {
46
+ window.sessionStorage.setItem('mfa', mfaCode);
47
+ }
43
48
  DOM.queueUpdate(() => __awaiter(this, void 0, void 0, function* () {
44
49
  try {
45
50
  if (!this.connect.isConnected && this.config.autoConnect) {
@@ -88,21 +93,43 @@ let LoginForm = class LoginForm extends BaseRoute {
88
93
  return;
89
94
  }
90
95
  }
96
+ // TODO: temporarly disable this approach because server expect username and pass when logging in with mfa
97
+ // const queryParams = new URLSearchParams(window.location.search);
98
+ //
99
+ // const mfaToken = queryParams.get('MFA_CODE');
100
+ // if (mfaToken) {
101
+ // const mfaCredentials = cm.createMFACredentials({
102
+ // /**
103
+ // * I think `token` is better as it's system gen vs code a user entered
104
+ // * TODO: Get server guys to update query param to MFA_TOKEN
105
+ // */
106
+ // mfaToken,
107
+ // });
108
+ // if (cm.validateMFACredentials(mfaCredentials)) {
109
+ // logger.debug(`Attempting to login with mfa credentials.`);
110
+ // this.login(mfaCredentials);
111
+ // return;
112
+ // }
113
+ // }
91
114
  this.attemptBasicLogin();
92
115
  }
93
116
  });
94
117
  }
95
118
  attemptBasicLogin() {
119
+ const mfaToken = window.sessionStorage.getItem('mfa');
96
120
  const basicCredentials = this.credentialManager.createBasicCredentials({
97
121
  username: this.orgUsername,
98
122
  password: this.password,
123
+ mfaToken: mfaToken,
99
124
  });
100
125
  if (!this.credentialManager.validateBasicCredentials(basicCredentials)) {
101
126
  logger.debug(`Basic credentials appear invalid, aborting login attempt.`);
102
127
  return;
103
128
  }
104
129
  logger.debug(`Attempting to login with basic credentials.`);
105
- this.login(basicCredentials);
130
+ this.login(basicCredentials).then(() => {
131
+ window.sessionStorage.removeItem('mfa');
132
+ });
106
133
  }
107
134
  ssoToggledChanged() {
108
135
  var _a, _b;
@@ -192,6 +219,10 @@ let LoginForm = class LoginForm extends BaseRoute {
192
219
  this.onNavigate(this.getSubRoutePath('reset-password?expired'));
193
220
  return;
194
221
  }
222
+ if (err.hasMFAError()) {
223
+ this.setError('Please check your inbox for your login link.');
224
+ return;
225
+ }
195
226
  if (this.config.fields.organisation &&
196
227
  this.config.fields.organisation.required !== false &&
197
228
  !this.organisation.length) {
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.77.2",
4
+ "version": "14.78.0-mfa-auth.2",
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.77.2",
53
- "@genesislcap/genx": "14.77.2",
52
+ "@genesislcap/foundation-testing": "14.78.0-mfa-auth.2",
53
+ "@genesislcap/genx": "14.78.0-mfa-auth.2",
54
54
  "rimraf": "^3.0.2"
55
55
  },
56
56
  "dependencies": {
57
- "@genesislcap/foundation-comms": "14.77.2",
58
- "@genesislcap/foundation-ui": "14.77.2",
59
- "@genesislcap/foundation-utils": "14.77.2",
60
- "@genesislcap/foundation-zero": "14.77.2",
57
+ "@genesislcap/foundation-comms": "14.78.0-mfa-auth.2",
58
+ "@genesislcap/foundation-ui": "14.78.0-mfa-auth.2",
59
+ "@genesislcap/foundation-utils": "14.78.0-mfa-auth.2",
60
+ "@genesislcap/foundation-zero": "14.78.0-mfa-auth.2",
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": "b47f3a7923044c6a2075e35d8bb066bddb9f9bad"
77
+ "gitHead": "8c05be41efd2c388ec8ea0d091b163c52e1d5540"
78
78
  }