@como/como-client 0.7.85 → 0.7.86
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/lib/como.js +11 -14
- package/lib/services/auth.service.js +26 -20
- package/package.json +1 -1
- package/src/como.js +0 -3
package/lib/como.js
CHANGED
|
@@ -268,12 +268,12 @@ var Como = function () {
|
|
|
268
268
|
break;
|
|
269
269
|
|
|
270
270
|
case 49:
|
|
271
|
-
_context2.next =
|
|
271
|
+
_context2.next = 73;
|
|
272
272
|
break;
|
|
273
273
|
|
|
274
274
|
case 51:
|
|
275
275
|
if (isExpired) {
|
|
276
|
-
_context2.next =
|
|
276
|
+
_context2.next = 73;
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
279
|
|
|
@@ -281,7 +281,7 @@ var Como = function () {
|
|
|
281
281
|
|
|
282
282
|
case 53:
|
|
283
283
|
if (!(!signOnSuccessfully && interval < 3000)) {
|
|
284
|
-
_context2.next =
|
|
284
|
+
_context2.next = 73;
|
|
285
285
|
break;
|
|
286
286
|
}
|
|
287
287
|
|
|
@@ -299,41 +299,38 @@ var Como = function () {
|
|
|
299
299
|
console.log('signOn- updating credentials');
|
|
300
300
|
updateCredentials(_data2, true);
|
|
301
301
|
}
|
|
302
|
-
if (_data2 && _data2.config && _data2.config.recaptchaSiteKey) {
|
|
303
|
-
this.comoData.reCaptchaSiteKey = _data2.config.recaptchaSiteKey;
|
|
304
|
-
}
|
|
305
302
|
signOnSuccessfully = true;
|
|
306
|
-
_context2.next =
|
|
303
|
+
_context2.next = 71;
|
|
307
304
|
break;
|
|
308
305
|
|
|
309
|
-
case
|
|
310
|
-
_context2.prev =
|
|
306
|
+
case 64:
|
|
307
|
+
_context2.prev = 64;
|
|
311
308
|
_context2.t2 = _context2['catch'](54);
|
|
312
309
|
|
|
313
310
|
console.error('Failed signOn with accessToken, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken + ', error:' + _context2.t2.message);
|
|
314
311
|
interval += 1000;
|
|
315
312
|
initService.logError({ method: 'signOn with credentials', accessToken: accessToken, isExpired: isExpired, refreshFailed: refreshFailed, credExist: credExist, installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, interval: interval, error: _context2.t2.message });
|
|
316
|
-
_context2.next =
|
|
313
|
+
_context2.next = 71;
|
|
317
314
|
return new _promise2.default(function (r) {
|
|
318
315
|
return setTimeout(r, interval);
|
|
319
316
|
});
|
|
320
317
|
|
|
321
|
-
case
|
|
318
|
+
case 71:
|
|
322
319
|
_context2.next = 53;
|
|
323
320
|
break;
|
|
324
321
|
|
|
325
|
-
case
|
|
322
|
+
case 73:
|
|
326
323
|
if (!this.comoData.token) {
|
|
327
324
|
this.comoData.token = this.comoData.accessToken;
|
|
328
325
|
}
|
|
329
326
|
return _context2.abrupt('return', this.getCredentials());
|
|
330
327
|
|
|
331
|
-
case
|
|
328
|
+
case 75:
|
|
332
329
|
case 'end':
|
|
333
330
|
return _context2.stop();
|
|
334
331
|
}
|
|
335
332
|
}
|
|
336
|
-
}, _callee2, this, [[17, 24], [32, 40], [54,
|
|
333
|
+
}, _callee2, this, [[17, 24], [32, 40], [54, 64]]);
|
|
337
334
|
}));
|
|
338
335
|
|
|
339
336
|
function init(_x, _x2, _x3) {
|
|
@@ -67,21 +67,23 @@ exports.register = function (service) {
|
|
|
67
67
|
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(form, verification, reCaptchaToken) {
|
|
68
68
|
var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'App';
|
|
69
69
|
|
|
70
|
-
var _ref4, data;
|
|
70
|
+
var body, headers, _ref4, data;
|
|
71
71
|
|
|
72
72
|
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
|
73
73
|
while (1) {
|
|
74
74
|
switch (_context2.prev = _context2.next) {
|
|
75
75
|
case 0:
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
body = { form: form, verification: verification, reCaptchaToken: reCaptchaToken, source: source };
|
|
77
|
+
headers = getHashHeader(body);
|
|
78
|
+
_context2.next = 4;
|
|
79
|
+
return service.post('/auth/v1/registration', body, { headers: headers });
|
|
78
80
|
|
|
79
|
-
case
|
|
81
|
+
case 4:
|
|
80
82
|
_ref4 = _context2.sent;
|
|
81
83
|
data = _ref4.data;
|
|
82
84
|
return _context2.abrupt("return", data);
|
|
83
85
|
|
|
84
|
-
case
|
|
86
|
+
case 7:
|
|
85
87
|
case "end":
|
|
86
88
|
return _context2.stop();
|
|
87
89
|
}
|
|
@@ -98,22 +100,23 @@ exports.register = function (service) {
|
|
|
98
100
|
exports.registerVerify = function (service) {
|
|
99
101
|
return function () {
|
|
100
102
|
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(verification, type, form, reCaptchaToken) {
|
|
101
|
-
var body, _ref6, data;
|
|
103
|
+
var body, headers, _ref6, data;
|
|
102
104
|
|
|
103
105
|
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
|
104
106
|
while (1) {
|
|
105
107
|
switch (_context3.prev = _context3.next) {
|
|
106
108
|
case 0:
|
|
107
109
|
body = { verification: verification, type: type, form: form, reCaptchaToken: reCaptchaToken };
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
headers = getHashHeader(body);
|
|
111
|
+
_context3.next = 4;
|
|
112
|
+
return service.post('/auth/v1/registration/verify', body, { headers: headers });
|
|
110
113
|
|
|
111
|
-
case
|
|
114
|
+
case 4:
|
|
112
115
|
_ref6 = _context3.sent;
|
|
113
116
|
data = _ref6.data;
|
|
114
117
|
return _context3.abrupt("return", data);
|
|
115
118
|
|
|
116
|
-
case
|
|
119
|
+
case 7:
|
|
117
120
|
case "end":
|
|
118
121
|
return _context3.stop();
|
|
119
122
|
}
|
|
@@ -132,21 +135,23 @@ exports.updateProfile = function (service) {
|
|
|
132
135
|
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(form, reCaptchaToken) {
|
|
133
136
|
var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'App';
|
|
134
137
|
|
|
135
|
-
var _ref8, data;
|
|
138
|
+
var body, headers, _ref8, data;
|
|
136
139
|
|
|
137
140
|
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
|
138
141
|
while (1) {
|
|
139
142
|
switch (_context4.prev = _context4.next) {
|
|
140
143
|
case 0:
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
body = { form: form, source: source, reCaptchaToken: reCaptchaToken };
|
|
145
|
+
headers = getHashHeader(body);
|
|
146
|
+
_context4.next = 4;
|
|
147
|
+
return service.post('/auth/v1/update-profile', body, { headers: headers });
|
|
143
148
|
|
|
144
|
-
case
|
|
149
|
+
case 4:
|
|
145
150
|
_ref8 = _context4.sent;
|
|
146
151
|
data = _ref8.data;
|
|
147
152
|
return _context4.abrupt("return", data);
|
|
148
153
|
|
|
149
|
-
case
|
|
154
|
+
case 7:
|
|
150
155
|
case "end":
|
|
151
156
|
return _context4.stop();
|
|
152
157
|
}
|
|
@@ -165,22 +170,23 @@ exports.updateProfileVerify = function (service) {
|
|
|
165
170
|
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(code, type, form, reCaptchaToken) {
|
|
166
171
|
var source = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'App';
|
|
167
172
|
|
|
168
|
-
var body, _ref10, data;
|
|
173
|
+
var body, headers, _ref10, data;
|
|
169
174
|
|
|
170
175
|
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
|
171
176
|
while (1) {
|
|
172
177
|
switch (_context5.prev = _context5.next) {
|
|
173
178
|
case 0:
|
|
174
179
|
body = { code: code, type: type, form: form, source: source, reCaptchaToken: reCaptchaToken };
|
|
175
|
-
|
|
176
|
-
|
|
180
|
+
headers = getHashHeader(body);
|
|
181
|
+
_context5.next = 4;
|
|
182
|
+
return service.post('/auth/v1/update-profile/verify', body, { headers: headers });
|
|
177
183
|
|
|
178
|
-
case
|
|
184
|
+
case 4:
|
|
179
185
|
_ref10 = _context5.sent;
|
|
180
186
|
data = _ref10.data;
|
|
181
187
|
return _context5.abrupt("return", data);
|
|
182
188
|
|
|
183
|
-
case
|
|
189
|
+
case 7:
|
|
184
190
|
case "end":
|
|
185
191
|
return _context5.stop();
|
|
186
192
|
}
|
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -143,9 +143,6 @@ class Como {
|
|
|
143
143
|
console.log(`signOn- updating credentials`);
|
|
144
144
|
updateCredentials(data, true);
|
|
145
145
|
}
|
|
146
|
-
if(data && data.config && data.config.recaptchaSiteKey){
|
|
147
|
-
this.comoData.reCaptchaSiteKey = data.config.recaptchaSiteKey;
|
|
148
|
-
}
|
|
149
146
|
signOnSuccessfully = true;
|
|
150
147
|
}catch(e){
|
|
151
148
|
console.error(`Failed signOn with accessToken, installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}, error:${e.message}`);
|