@sumaris-net/ngx-components 2.4.82-rc2 → 2.4.82-rc4
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 +18 -5
- package/esm2020/src/environments/environment.class.mjs +1 -1
- package/esm2020/src/environments/environment.mjs +5 -6
- package/fesm2015/sumaris-net.ngx-components.mjs +22 -9
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +21 -9
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/environments/environment.class.d.ts +1 -0
|
@@ -11642,11 +11642,10 @@ const environment = Object.freeze({
|
|
|
11642
11642
|
helpUrl: 'https://gitlab.ifremer.fr/sih-public/sumaris/sumaris-doc/-/blob/master/user-manual/index_fr.md',
|
|
11643
11643
|
// Development
|
|
11644
11644
|
defaultAuthValues: {
|
|
11645
|
-
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
username: 'benoit.lavenier@e-is.pro', password: 'priezPourMoi!',
|
|
11645
|
+
// Basic auth (using Person.username)
|
|
11646
|
+
// username: 'admq2', password: 'q22006'
|
|
11647
|
+
// Token auth (using Person.pubkey)
|
|
11648
|
+
//username: 'admin@sumaris.net', password: 'admin',
|
|
11650
11649
|
},
|
|
11651
11650
|
account: {
|
|
11652
11651
|
enableListenChanges: true,
|
|
@@ -17987,9 +17986,14 @@ class AccountService extends BaseGraphqlService {
|
|
|
17987
17986
|
this.storage.get(TOKEN_STORAGE_KEY),
|
|
17988
17987
|
this.storage.get(SECKEY_STORAGE_KEY)
|
|
17989
17988
|
]);
|
|
17990
|
-
|
|
17991
|
-
|
|
17989
|
+
let pubkey = values[0];
|
|
17990
|
+
let token = values[1];
|
|
17992
17991
|
const seckey = values[2];
|
|
17992
|
+
// DEV only - auth by token
|
|
17993
|
+
if (!this.environment.production && this.environment.defaultAuthValues?.token) {
|
|
17994
|
+
token = token || this.environment.defaultAuthValues.token;
|
|
17995
|
+
pubkey = pubkey || token?.split(':', 2)[0];
|
|
17996
|
+
}
|
|
17993
17997
|
// Quit if no pubkey (not logged)
|
|
17994
17998
|
if (!pubkey)
|
|
17995
17999
|
return;
|
|
@@ -18035,8 +18039,16 @@ class AccountService extends BaseGraphqlService {
|
|
|
18035
18039
|
jsonAccount = accountStr && ((typeof accountStr === 'string') && JSON.parse(jsonAccount) || accountStr);
|
|
18036
18040
|
}
|
|
18037
18041
|
// Invalid account: do not use it
|
|
18038
|
-
if (!jsonAccount || jsonAccount.pubkey !== pubkey)
|
|
18039
|
-
|
|
18042
|
+
if (!jsonAccount || jsonAccount.pubkey !== pubkey) {
|
|
18043
|
+
// DEV only: create a fake account with given username
|
|
18044
|
+
if (!this.environment.production && this.environment.defaultAuthValues.username) {
|
|
18045
|
+
const username = this.environment.defaultAuthValues.username;
|
|
18046
|
+
jsonAccount = { pubkey, username, firstName: username, lastName: username };
|
|
18047
|
+
}
|
|
18048
|
+
else {
|
|
18049
|
+
return;
|
|
18050
|
+
}
|
|
18051
|
+
}
|
|
18040
18052
|
// Transform to entity
|
|
18041
18053
|
const account = Account.fromObject(jsonAccount);
|
|
18042
18054
|
// Update data
|