@sumaris-net/ngx-components 2.4.82-rc2 → 2.4.82-rc3
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/esm2020/src/app/core/services/account.service.mjs +17 -5
- package/esm2020/src/environments/environment.class.mjs +1 -1
- package/esm2020/src/environments/environment.mjs +3 -2
- package/fesm2015/sumaris-net.ngx-components.mjs +19 -5
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +18 -5
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/environments/environment.class.d.ts +2 -0
|
@@ -11692,7 +11692,8 @@ const environment = Object.freeze({
|
|
|
11692
11692
|
// username: 'admq2', password: 'q22006'
|
|
11693
11693
|
// Token auth (using Person.pubkey)
|
|
11694
11694
|
//username: 'admin@sumaris.net', password: 'admin',
|
|
11695
|
-
username: '
|
|
11695
|
+
username: 'lpecquot',
|
|
11696
|
+
pubkey: 'GEj5KLU3NoHPEW7hEmrbTc3srqnGgtr7KehAt8YVbsbP', token: 'GEj5KLU3NoHPEW7hEmrbTc3srqnGgtr7KehAt8YVbsbP:9C4B3A4560F52BDB1E3DACDEC973C077AE7A8FE8E005F3683BE52ADC718BC818|Jktzj/MYewXGWSIbw+MXq0QgzzduSat0ODsgHpDLRonxfipReplp2Y9xPUfsCD6Y1cEvW4JxNtHIsi7c7GOWAA=='
|
|
11696
11697
|
},
|
|
11697
11698
|
account: {
|
|
11698
11699
|
enableListenChanges: true,
|
|
@@ -18225,6 +18226,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
18225
18226
|
});
|
|
18226
18227
|
}
|
|
18227
18228
|
restoreLocally() {
|
|
18229
|
+
var _a;
|
|
18228
18230
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18229
18231
|
// Restore from storage
|
|
18230
18232
|
const values = yield Promise.all([
|
|
@@ -18232,9 +18234,14 @@ class AccountService extends BaseGraphqlService {
|
|
|
18232
18234
|
this.storage.get(TOKEN_STORAGE_KEY),
|
|
18233
18235
|
this.storage.get(SECKEY_STORAGE_KEY)
|
|
18234
18236
|
]);
|
|
18235
|
-
|
|
18236
|
-
|
|
18237
|
+
let pubkey = values[0];
|
|
18238
|
+
let token = values[1];
|
|
18237
18239
|
const seckey = values[2];
|
|
18240
|
+
// DEV only - restore pubkey/token
|
|
18241
|
+
if (!this.environment.production && ((_a = this.environment.defaultAuthValues) === null || _a === void 0 ? void 0 : _a.token)) {
|
|
18242
|
+
token = token || this.environment.defaultAuthValues.token;
|
|
18243
|
+
pubkey = pubkey || this.environment.defaultAuthValues.pubkey || (token === null || token === void 0 ? void 0 : token.split(':')[0]);
|
|
18244
|
+
}
|
|
18238
18245
|
// Quit if no pubkey (not logged)
|
|
18239
18246
|
if (!pubkey)
|
|
18240
18247
|
return;
|
|
@@ -18280,8 +18287,15 @@ class AccountService extends BaseGraphqlService {
|
|
|
18280
18287
|
jsonAccount = accountStr && ((typeof accountStr === 'string') && JSON.parse(jsonAccount) || accountStr);
|
|
18281
18288
|
}
|
|
18282
18289
|
// Invalid account: do not use it
|
|
18283
|
-
if (!jsonAccount || jsonAccount.pubkey !== pubkey)
|
|
18284
|
-
|
|
18290
|
+
if (!jsonAccount || jsonAccount.pubkey !== pubkey) {
|
|
18291
|
+
if (!this.environment.production && this.environment.defaultAuthValues.username) {
|
|
18292
|
+
const username = this.environment.defaultAuthValues.username;
|
|
18293
|
+
jsonAccount = { pubkey, username, firstName: username, lastName: username };
|
|
18294
|
+
}
|
|
18295
|
+
else {
|
|
18296
|
+
return;
|
|
18297
|
+
}
|
|
18298
|
+
}
|
|
18285
18299
|
// Transform to entity
|
|
18286
18300
|
const account = Account.fromObject(jsonAccount);
|
|
18287
18301
|
// Update data
|