@etsoo/react 1.3.68 → 1.3.69

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.
@@ -21,9 +21,9 @@ export declare class ServiceApp<P extends IServicePageData = IServicePageData, U
21
21
  */
22
22
  coreUser?: ISmartERPUser;
23
23
  /**
24
- * Service device id
24
+ * Service passphrase
25
25
  */
26
- protected serviceDeviceId: string;
26
+ servicePassphrase: string;
27
27
  /**
28
28
  * Constructor
29
29
  * @param settings Settings
@@ -17,9 +17,9 @@ export class ServiceApp extends ReactApp {
17
17
  constructor(settings, name) {
18
18
  super(settings, name);
19
19
  /**
20
- * Service device id
20
+ * Service passphrase
21
21
  */
22
- this.serviceDeviceId = '';
22
+ this.servicePassphrase = '';
23
23
  // Check
24
24
  if (settings.serviceId == null || settings.coreApi == null) {
25
25
  throw new Error('No service settings');
@@ -183,7 +183,7 @@ export class ServiceApp extends ReactApp {
183
183
  * @returns Pure text
184
184
  */
185
185
  serviceDecrypt(messageEncrypted, passphrase) {
186
- return this.decrypt(messageEncrypted, passphrase !== null && passphrase !== void 0 ? passphrase : this.serviceDeviceId);
186
+ return this.decrypt(messageEncrypted, passphrase !== null && passphrase !== void 0 ? passphrase : this.servicePassphrase);
187
187
  }
188
188
  /**
189
189
  * Service encrypt message
@@ -193,7 +193,7 @@ export class ServiceApp extends ReactApp {
193
193
  * @returns Result
194
194
  */
195
195
  serviceEncrypt(message, passphrase, iterations) {
196
- return this.encrypt(message, passphrase !== null && passphrase !== void 0 ? passphrase : this.serviceDeviceId, iterations);
196
+ return this.encrypt(message, passphrase !== null && passphrase !== void 0 ? passphrase : this.servicePassphrase, iterations);
197
197
  }
198
198
  /**
199
199
  * Try login
@@ -229,8 +229,10 @@ export class ServiceApp extends ReactApp {
229
229
  * @param coreUser Core system user
230
230
  */
231
231
  userLoginEx(user, refreshToken, coreUser) {
232
+ var _a;
232
233
  // Service user login
233
- this.serviceDeviceId = user.serviceDeviceId;
234
+ this.servicePassphrase =
235
+ (_a = this.decrypt(user.serviceDeviceId, this.settings.serviceId.toString())) !== null && _a !== void 0 ? _a : '';
234
236
  super.userLogin(user, refreshToken, false);
235
237
  // Core system user
236
238
  this.coreUser = coreUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.3.68",
3
+ "version": "1.3.69",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -38,9 +38,9 @@ export class ServiceApp<
38
38
  coreUser?: ISmartERPUser;
39
39
 
40
40
  /**
41
- * Service device id
41
+ * Service passphrase
42
42
  */
43
- protected serviceDeviceId: string = '';
43
+ servicePassphrase: string = '';
44
44
 
45
45
  /**
46
46
  * Constructor
@@ -271,7 +271,7 @@ export class ServiceApp<
271
271
  serviceDecrypt(messageEncrypted: string, passphrase?: string) {
272
272
  return this.decrypt(
273
273
  messageEncrypted,
274
- passphrase ?? this.serviceDeviceId
274
+ passphrase ?? this.servicePassphrase
275
275
  );
276
276
  }
277
277
 
@@ -285,7 +285,7 @@ export class ServiceApp<
285
285
  serviceEncrypt(message: string, passphrase?: string, iterations?: number) {
286
286
  return this.encrypt(
287
287
  message,
288
- passphrase ?? this.serviceDeviceId,
288
+ passphrase ?? this.servicePassphrase,
289
289
  iterations
290
290
  );
291
291
  }
@@ -331,7 +331,11 @@ export class ServiceApp<
331
331
  coreUser: ISmartERPUser
332
332
  ): void {
333
333
  // Service user login
334
- this.serviceDeviceId = user.serviceDeviceId;
334
+ this.servicePassphrase =
335
+ this.decrypt(
336
+ user.serviceDeviceId,
337
+ this.settings.serviceId.toString()
338
+ ) ?? '';
335
339
  super.userLogin(user, refreshToken, false);
336
340
 
337
341
  // Core system user