@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.
@@ -11646,7 +11646,8 @@ const environment = Object.freeze({
11646
11646
  // username: 'admq2', password: 'q22006'
11647
11647
  // Token auth (using Person.pubkey)
11648
11648
  //username: 'admin@sumaris.net', password: 'admin',
11649
- username: 'benoit.lavenier@e-is.pro', password: 'priezPourMoi!',
11649
+ username: 'lpecquot',
11650
+ pubkey: 'GEj5KLU3NoHPEW7hEmrbTc3srqnGgtr7KehAt8YVbsbP', token: 'GEj5KLU3NoHPEW7hEmrbTc3srqnGgtr7KehAt8YVbsbP:9C4B3A4560F52BDB1E3DACDEC973C077AE7A8FE8E005F3683BE52ADC718BC818|Jktzj/MYewXGWSIbw+MXq0QgzzduSat0ODsgHpDLRonxfipReplp2Y9xPUfsCD6Y1cEvW4JxNtHIsi7c7GOWAA=='
11650
11651
  },
11651
11652
  account: {
11652
11653
  enableListenChanges: true,
@@ -17987,9 +17988,14 @@ class AccountService extends BaseGraphqlService {
17987
17988
  this.storage.get(TOKEN_STORAGE_KEY),
17988
17989
  this.storage.get(SECKEY_STORAGE_KEY)
17989
17990
  ]);
17990
- const pubkey = values[0];
17991
- const token = values[1];
17991
+ let pubkey = values[0];
17992
+ let token = values[1];
17992
17993
  const seckey = values[2];
17994
+ // DEV only - restore pubkey/token
17995
+ if (!this.environment.production && this.environment.defaultAuthValues?.token) {
17996
+ token = token || this.environment.defaultAuthValues.token;
17997
+ pubkey = pubkey || this.environment.defaultAuthValues.pubkey || token?.split(':')[0];
17998
+ }
17993
17999
  // Quit if no pubkey (not logged)
17994
18000
  if (!pubkey)
17995
18001
  return;
@@ -18035,8 +18041,15 @@ class AccountService extends BaseGraphqlService {
18035
18041
  jsonAccount = accountStr && ((typeof accountStr === 'string') && JSON.parse(jsonAccount) || accountStr);
18036
18042
  }
18037
18043
  // Invalid account: do not use it
18038
- if (!jsonAccount || jsonAccount.pubkey !== pubkey)
18039
- return;
18044
+ if (!jsonAccount || jsonAccount.pubkey !== pubkey) {
18045
+ if (!this.environment.production && this.environment.defaultAuthValues.username) {
18046
+ const username = this.environment.defaultAuthValues.username;
18047
+ jsonAccount = { pubkey, username, firstName: username, lastName: username };
18048
+ }
18049
+ else {
18050
+ return;
18051
+ }
18052
+ }
18040
18053
  // Transform to entity
18041
18054
  const account = Account.fromObject(jsonAccount);
18042
18055
  // Update data