@etsoo/materialui 1.3.92 → 1.3.94

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.
@@ -19,6 +19,11 @@ export interface IServiceUser extends IUser {
19
19
  * 服务(应用)加密密钥
20
20
  */
21
21
  readonly passphrase?: string;
22
+ /**
23
+ * Device id
24
+ * 设备编号
25
+ */
26
+ readonly deviceId?: string;
22
27
  }
23
28
  /**
24
29
  * Service user login result
@@ -42,8 +42,6 @@ export class ServiceApp extends ReactApp {
42
42
  toLoginPage(tryLogin, removeUrl) {
43
43
  // Cache current URL
44
44
  this.cachedUrl = removeUrl ? undefined : globalThis.location.href;
45
- // Make sure apply new device id for new login
46
- this.clearDeviceId();
47
45
  // Get the redirect URL
48
46
  this.api
49
47
  .get("Auth/GetLogInUrl", {
@@ -53,7 +51,8 @@ export class ServiceApp extends ReactApp {
53
51
  .then((url) => {
54
52
  if (!url)
55
53
  return;
56
- url += `?tryLogin=${tryLogin ?? false}`;
54
+ // Add try login flag
55
+ url = url.addUrlParam("tryLogin", tryLogin ?? false);
57
56
  if (BridgeUtils.host == null) {
58
57
  globalThis.location.href = url;
59
58
  }
@@ -61,6 +60,8 @@ export class ServiceApp extends ReactApp {
61
60
  BridgeUtils.host.loadApp(coreName, url);
62
61
  }
63
62
  });
63
+ // Make sure apply new device id for new login
64
+ this.clearDeviceId();
64
65
  }
65
66
  /**
66
67
  * User login extended
@@ -72,11 +73,13 @@ export class ServiceApp extends ReactApp {
72
73
  userLogin(user, refreshToken, keep, dispatch) {
73
74
  // Super call, set token
74
75
  super.userLogin(user, refreshToken, keep, dispatch);
75
- if (user.passphrase) {
76
+ if (user.deviceId && user.passphrase) {
76
77
  // Save the passphrase
77
78
  const passphrase = this.decrypt(user.passphrase, `${user.uid}-${this.settings.appId}`);
78
- if (passphrase)
79
+ if (passphrase) {
80
+ this.deviceId = user.deviceId;
79
81
  this.updatePassphrase(passphrase);
82
+ }
80
83
  }
81
84
  }
82
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.3.92",
3
+ "version": "1.3.94",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,12 +50,12 @@
50
50
  "@emotion/css": "^11.13.4",
51
51
  "@emotion/react": "^11.13.3",
52
52
  "@emotion/styled": "^11.13.0",
53
- "@etsoo/appscript": "^1.5.25",
54
- "@etsoo/notificationbase": "^1.1.48",
55
- "@etsoo/react": "^1.7.68",
56
- "@etsoo/shared": "^1.2.46",
57
- "@mui/icons-material": "^6.1.2",
58
- "@mui/material": "^6.1.2",
53
+ "@etsoo/appscript": "^1.5.27",
54
+ "@etsoo/notificationbase": "^1.1.49",
55
+ "@etsoo/react": "^1.7.69",
56
+ "@etsoo/shared": "^1.2.48",
57
+ "@mui/icons-material": "^6.1.3",
58
+ "@mui/material": "^6.1.3",
59
59
  "@mui/x-data-grid": "^7.19.0",
60
60
  "chart.js": "^4.4.4",
61
61
  "chartjs-plugin-datalabels": "^2.2.0",
@@ -87,10 +87,10 @@
87
87
  "@types/react-dom": "^18.3.0",
88
88
  "@types/react-input-mask": "^3.0.5",
89
89
  "@types/react-window": "^1.8.8",
90
- "@typescript-eslint/eslint-plugin": "^8.8.0",
91
- "@typescript-eslint/parser": "^8.8.0",
90
+ "@typescript-eslint/eslint-plugin": "^8.8.1",
91
+ "@typescript-eslint/parser": "^8.8.1",
92
92
  "jest": "^29.7.0",
93
93
  "jest-environment-jsdom": "^29.7.0",
94
- "typescript": "^5.6.2"
94
+ "typescript": "^5.6.3"
95
95
  }
96
96
  }
@@ -22,6 +22,12 @@ export interface IServiceUser extends IUser {
22
22
  * 服务(应用)加密密钥
23
23
  */
24
24
  readonly passphrase?: string;
25
+
26
+ /**
27
+ * Device id
28
+ * 设备编号
29
+ */
30
+ readonly deviceId?: string;
25
31
  }
26
32
 
27
33
  /**
@@ -69,9 +69,6 @@ export class ServiceApp<
69
69
  // Cache current URL
70
70
  this.cachedUrl = removeUrl ? undefined : globalThis.location.href;
71
71
 
72
- // Make sure apply new device id for new login
73
- this.clearDeviceId();
74
-
75
72
  // Get the redirect URL
76
73
  this.api
77
74
  .get<string>("Auth/GetLogInUrl", {
@@ -81,7 +78,8 @@ export class ServiceApp<
81
78
  .then((url) => {
82
79
  if (!url) return;
83
80
 
84
- url += `?tryLogin=${tryLogin ?? false}`;
81
+ // Add try login flag
82
+ url = url.addUrlParam("tryLogin", tryLogin ?? false);
85
83
 
86
84
  if (BridgeUtils.host == null) {
87
85
  globalThis.location.href = url;
@@ -89,6 +87,9 @@ export class ServiceApp<
89
87
  BridgeUtils.host.loadApp(coreName, url);
90
88
  }
91
89
  });
90
+
91
+ // Make sure apply new device id for new login
92
+ this.clearDeviceId();
92
93
  }
93
94
 
94
95
  /**
@@ -107,13 +108,16 @@ export class ServiceApp<
107
108
  // Super call, set token
108
109
  super.userLogin(user, refreshToken, keep, dispatch);
109
110
 
110
- if (user.passphrase) {
111
+ if (user.deviceId && user.passphrase) {
111
112
  // Save the passphrase
112
113
  const passphrase = this.decrypt(
113
114
  user.passphrase,
114
115
  `${user.uid}-${this.settings.appId}`
115
116
  );
116
- if (passphrase) this.updatePassphrase(passphrase);
117
+ if (passphrase) {
118
+ this.deviceId = user.deviceId;
119
+ this.updatePassphrase(passphrase);
120
+ }
117
121
  }
118
122
  }
119
123
  }