@etsoo/appscript 1.2.63 → 1.2.66

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.
@@ -160,6 +160,12 @@ test('Tests for getUnitLabel', () => {
160
160
  expect(app.getUnitLabel(12, true)).toBe('每年');
161
161
  });
162
162
 
163
+ test('Tests for isValidPassword', () => {
164
+ expect(app.isValidPassword('12345678')).toBeFalsy();
165
+ expect(app.isValidPassword('abcd3')).toBeFalsy();
166
+ expect(app.isValidPassword('1234abcd')).toBeTruthy();
167
+ });
168
+
163
169
  test('Tests for getRepeatOptions', () => {
164
170
  const options = BusinessUtils.getRepeatOptions(app.labelDelegate, [
165
171
  'MONTH',
@@ -303,6 +303,11 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
303
303
  * @returns Result
304
304
  */
305
305
  initCall(callback?: (result: boolean) => void, resetKeys?: boolean): Promise<void>;
306
+ /**
307
+ * Is valid password, override to implement custom check
308
+ * @param password Input password
309
+ */
310
+ isValidPassword(password: string): boolean;
306
311
  /**
307
312
  * Callback where exit a page
308
313
  */
@@ -496,6 +501,11 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
496
501
  * Restore settings from persisted source
497
502
  */
498
503
  protected restore(): boolean;
504
+ /**
505
+ * Is valid password, override to implement custom check
506
+ * @param password Input password
507
+ */
508
+ isValidPassword(password: string): boolean;
499
509
  /**
500
510
  * Persist settings to source when application exit
501
511
  */
@@ -511,6 +521,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
511
521
  * @returns Result
512
522
  */
513
523
  protected apiInitCall(data: InitCallDto): Promise<InitCallResult | undefined>;
524
+ /**
525
+ * Check the action result is about device invalid
526
+ * @param result Action result
527
+ * @returns true means device is invalid
528
+ */
529
+ protected checkDeviceResult(result: IActionResult): boolean;
514
530
  /**
515
531
  * Init call
516
532
  * @param callback Callback
@@ -195,6 +195,20 @@ class CoreApp {
195
195
  }
196
196
  return false;
197
197
  }
198
+ /**
199
+ * Is valid password, override to implement custom check
200
+ * @param password Input password
201
+ */
202
+ isValidPassword(password) {
203
+ // Length check
204
+ if (password.length < 6)
205
+ return false;
206
+ // One letter and number required
207
+ if (/\d+/gi.test(password) && /[a-z]+/gi.test(password)) {
208
+ return true;
209
+ }
210
+ return false;
211
+ }
198
212
  /**
199
213
  * Persist settings to source when application exit
200
214
  */
@@ -255,6 +269,16 @@ class CoreApp {
255
269
  async apiInitCall(data) {
256
270
  return await this.api.put(this.initCallApi, data);
257
271
  }
272
+ /**
273
+ * Check the action result is about device invalid
274
+ * @param result Action result
275
+ * @returns true means device is invalid
276
+ */
277
+ checkDeviceResult(result) {
278
+ if (result.type == 'NoValidData' && result.field == 'Device')
279
+ return true;
280
+ return false;
281
+ }
258
282
  /**
259
283
  * Init call
260
284
  * @param callback Callback
@@ -264,8 +288,10 @@ class CoreApp {
264
288
  async initCall(callback, resetKeys) {
265
289
  var _a;
266
290
  // Reset keys
267
- if (resetKeys)
291
+ if (resetKeys) {
292
+ this._deviceId = '';
268
293
  this.resetKeys();
294
+ }
269
295
  // Passphrase exists?
270
296
  if (this.passphrase) {
271
297
  if (callback)
@@ -8,6 +8,7 @@
8
8
  "approve": "Approve it",
9
9
  "back": "Back",
10
10
  "cancel": "Cancel",
11
+ "changePassword": "Change password",
11
12
  "clear": "Clear",
12
13
  "close": "Close",
13
14
  "confirm": "Confirm",
@@ -15,6 +16,8 @@
15
16
  "completeTip": "{0} completed",
16
17
  "copy": "Copy",
17
18
  "creation": "Creation",
19
+ "currentPassword": "Current password",
20
+ "currentPasswordRequired": "Please enter your current password",
18
21
  "currency": "Currency",
19
22
  "currencyAUD": "Australia Dollar $",
20
23
  "currencyCAD": "Canada Dollar $",
@@ -69,6 +72,9 @@
69
72
  "more": "More",
70
73
  "moreTag": "{0} more",
71
74
  "name": "Name",
75
+ "newPassword": "New password",
76
+ "newPasswordRequired": "Please enter your new password",
77
+ "newPasswordTip": "New password should be different",
72
78
  "newValue": "New value",
73
79
  "no": "No",
74
80
  "noChanges": "No changes yet",
@@ -81,6 +87,9 @@
81
87
  "openMenu": "Open menu",
82
88
  "operationSucceeded": "Operation succeeded",
83
89
  "pageNotFound": "Page Not Found",
90
+ "passwordChangeSuccess": "Password changed successfully, please sign in again",
91
+ "passwordRepeatError": "The two passwords entered are inconsistent",
92
+ "passwordTip": "The password cannot be less than 6 characters and contains at least one letter and number",
84
93
  "prompt": "Input",
85
94
  "pullToRefresh": "Pull down to refresh",
86
95
  "quarters": ["Q1", "Q2", "Q3", "Q4"],
@@ -91,6 +100,8 @@
91
100
  "reloginTip": "Please enter your password, resubmit the data after successful login",
92
101
  "remove": "Remove",
93
102
  "renew": "Renew",
103
+ "repeatPassword": "Repeat the password",
104
+ "repeatPasswordRequired": "Please repeat the new password",
94
105
  "reports": "Reports",
95
106
  "requiredField": "{0} is a required field",
96
107
  "resending": "Resending",
@@ -148,6 +159,7 @@
148
159
  "updateReady": "Update ready",
149
160
  "updateTip": "Restart the application to use the latest features",
150
161
  "user": "User",
162
+ "users": "Users",
151
163
  "view": "View",
152
164
  "warning": "Warning",
153
165
  "welcome": "{0}, welcome!"
@@ -2,12 +2,13 @@
2
2
  "accountant": "会计",
3
3
  "actions": "操作",
4
4
  "add": "添加",
5
- "audits": "稽核历史",
5
+ "audits": "操作历史",
6
6
  "authorizer": "授权人",
7
7
  "applicant": "申请人",
8
8
  "approve": "批准",
9
9
  "back": "后退",
10
10
  "cancel": "取消",
11
+ "changePassword": "修改密码",
11
12
  "clear": "清除",
12
13
  "close": "关闭",
13
14
  "confirm": "确认",
@@ -15,6 +16,8 @@
15
16
  "completeTip": "已完成 {0}",
16
17
  "copy": "复制",
17
18
  "creation": "登记时间",
19
+ "currentPassword": "当前密码",
20
+ "currentPasswordRequired": "请输入现在使用的密码",
18
21
  "currency": "币种",
19
22
  "currencyAUD": "澳元$",
20
23
  "currencyCAD": "加元$",
@@ -69,6 +72,9 @@
69
72
  "more": "更多",
70
73
  "moreTag": "({0}+)",
71
74
  "name": "姓名",
75
+ "newPassword": "新密码",
76
+ "newPasswordRequired": "请输入新密码",
77
+ "newPasswordTip": "请设置一个和现在的密码不一样的新密码",
72
78
  "newValue": "新值",
73
79
  "no": "否",
74
80
  "noChanges": "还没有任何修改",
@@ -81,6 +87,9 @@
81
87
  "openMenu": "打开菜单",
82
88
  "operationSucceeded": "操作成功",
83
89
  "pageNotFound": "找不到页面",
90
+ "passwordChangeSuccess": "密码修改成功,请重新登录",
91
+ "passwordRepeatError": "两次输入的密码不一致",
92
+ "passwordTip": "密码不能少于6个字符,且至少包含一个字母和数字",
84
93
  "prompt": "输入",
85
94
  "pullToRefresh": "下拉刷新",
86
95
  "quarters": ["一季度", "二季度", "三季度", "四季度"],
@@ -91,6 +100,8 @@
91
100
  "reloginTip": "请输入您的登录密码,登录成功后请重新提交数据",
92
101
  "remove": "移除",
93
102
  "renew": "续费",
103
+ "repeatPassword": "重复密码",
104
+ "repeatPasswordRequired": "请重复输入新密码",
94
105
  "reports": "统计报表",
95
106
  "requiredField": "'{0}'不能为空",
96
107
  "resending": "重新发送",
@@ -149,6 +160,7 @@
149
160
  "updateReady": "更新就绪",
150
161
  "updateTip": "重新启动应用程序以使用最新功能",
151
162
  "user": "用户",
163
+ "users": "用户",
152
164
  "view": "查看",
153
165
  "warning": "警告",
154
166
  "welcome": "{0}, 欢迎光临!"
@@ -2,12 +2,13 @@
2
2
  "accountant": "會計",
3
3
  "actions": "操作",
4
4
  "add": "添加",
5
- "audits": "稽核歷史",
5
+ "audits": "操作歷史",
6
6
  "authorizer": "授權人",
7
7
  "applicant": "申請人",
8
8
  "approve": "批准",
9
9
  "back": "後退",
10
10
  "cancel": "取消",
11
+ "changePassword": "修改密碼",
11
12
  "clear": "清除",
12
13
  "close": "關閉",
13
14
  "confirm": "確認",
@@ -15,6 +16,8 @@
15
16
  "completeTip": "已完成 {0}",
16
17
  "copy": "複製",
17
18
  "creation": "登記時間",
19
+ "currentPassword": "當前密碼",
20
+ "currentPasswordRequired": "請輸入現在使用的密碼",
18
21
  "currency": "幣種",
19
22
  "currencyAUD": "澳元$",
20
23
  "currencyCAD": "加元$",
@@ -69,6 +72,9 @@
69
72
  "more": "更多",
70
73
  "moreTag": "({0}+)",
71
74
  "name": "姓名",
75
+ "newPassword": "新密碼",
76
+ "newPasswordRequired": "請輸入新密碼",
77
+ "newPasswordTip": "請設置一個和現在的密碼不一樣的新密碼",
72
78
  "newValue": "舊值",
73
79
  "no": "否",
74
80
  "noChanges": "還沒有任何修改",
@@ -81,6 +87,9 @@
81
87
  "openMenu": "打開菜單",
82
88
  "operationSucceeded": "操作成功",
83
89
  "pageNotFound": "找不到頁面",
90
+ "passwordChangeSuccess": "密碼修改成功,請重新登錄",
91
+ "passwordRepeatError": "兩次輸入的密碼不一致",
92
+ "passwordTip": "密碼不能少於6個字符,且至少包含一個字母和數字",
84
93
  "prompt": "輸入",
85
94
  "pullToRefresh": "下拉刷新",
86
95
  "quarters": ["一季度", "二季度", "三季度", "四季度"],
@@ -93,6 +102,8 @@
93
102
  "renew": "續費",
94
103
  "reports": "統計報表",
95
104
  "requiredField": "'{0}'不能為空",
105
+ "repeatPassword": "重複密碼",
106
+ "repeatPasswordRequired": "請重複輸入新密碼",
96
107
  "resending": "重新發送",
97
108
  "reset": "重置",
98
109
  "rotateLeft": "左旋轉90°",
@@ -148,6 +159,7 @@
148
159
  "updateReady": "更新就緒",
149
160
  "updateTip": "重新啟動應用程序以使用最新功能",
150
161
  "user": "用戶",
162
+ "users": "用戶",
151
163
  "view": "查看",
152
164
  "warning": "警告",
153
165
  "welcome": "{0}, 歡迎光臨!"
@@ -303,6 +303,11 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
303
303
  * @returns Result
304
304
  */
305
305
  initCall(callback?: (result: boolean) => void, resetKeys?: boolean): Promise<void>;
306
+ /**
307
+ * Is valid password, override to implement custom check
308
+ * @param password Input password
309
+ */
310
+ isValidPassword(password: string): boolean;
306
311
  /**
307
312
  * Callback where exit a page
308
313
  */
@@ -496,6 +501,11 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
496
501
  * Restore settings from persisted source
497
502
  */
498
503
  protected restore(): boolean;
504
+ /**
505
+ * Is valid password, override to implement custom check
506
+ * @param password Input password
507
+ */
508
+ isValidPassword(password: string): boolean;
499
509
  /**
500
510
  * Persist settings to source when application exit
501
511
  */
@@ -511,6 +521,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
511
521
  * @returns Result
512
522
  */
513
523
  protected apiInitCall(data: InitCallDto): Promise<InitCallResult | undefined>;
524
+ /**
525
+ * Check the action result is about device invalid
526
+ * @param result Action result
527
+ * @returns true means device is invalid
528
+ */
529
+ protected checkDeviceResult(result: IActionResult): boolean;
514
530
  /**
515
531
  * Init call
516
532
  * @param callback Callback
@@ -192,6 +192,20 @@ export class CoreApp {
192
192
  }
193
193
  return false;
194
194
  }
195
+ /**
196
+ * Is valid password, override to implement custom check
197
+ * @param password Input password
198
+ */
199
+ isValidPassword(password) {
200
+ // Length check
201
+ if (password.length < 6)
202
+ return false;
203
+ // One letter and number required
204
+ if (/\d+/gi.test(password) && /[a-z]+/gi.test(password)) {
205
+ return true;
206
+ }
207
+ return false;
208
+ }
195
209
  /**
196
210
  * Persist settings to source when application exit
197
211
  */
@@ -252,6 +266,16 @@ export class CoreApp {
252
266
  async apiInitCall(data) {
253
267
  return await this.api.put(this.initCallApi, data);
254
268
  }
269
+ /**
270
+ * Check the action result is about device invalid
271
+ * @param result Action result
272
+ * @returns true means device is invalid
273
+ */
274
+ checkDeviceResult(result) {
275
+ if (result.type == 'NoValidData' && result.field == 'Device')
276
+ return true;
277
+ return false;
278
+ }
255
279
  /**
256
280
  * Init call
257
281
  * @param callback Callback
@@ -261,8 +285,10 @@ export class CoreApp {
261
285
  async initCall(callback, resetKeys) {
262
286
  var _a;
263
287
  // Reset keys
264
- if (resetKeys)
288
+ if (resetKeys) {
289
+ this._deviceId = '';
265
290
  this.resetKeys();
291
+ }
266
292
  // Passphrase exists?
267
293
  if (this.passphrase) {
268
294
  if (callback)
@@ -8,6 +8,7 @@
8
8
  "approve": "Approve it",
9
9
  "back": "Back",
10
10
  "cancel": "Cancel",
11
+ "changePassword": "Change password",
11
12
  "clear": "Clear",
12
13
  "close": "Close",
13
14
  "confirm": "Confirm",
@@ -15,6 +16,8 @@
15
16
  "completeTip": "{0} completed",
16
17
  "copy": "Copy",
17
18
  "creation": "Creation",
19
+ "currentPassword": "Current password",
20
+ "currentPasswordRequired": "Please enter your current password",
18
21
  "currency": "Currency",
19
22
  "currencyAUD": "Australia Dollar $",
20
23
  "currencyCAD": "Canada Dollar $",
@@ -69,6 +72,9 @@
69
72
  "more": "More",
70
73
  "moreTag": "{0} more",
71
74
  "name": "Name",
75
+ "newPassword": "New password",
76
+ "newPasswordRequired": "Please enter your new password",
77
+ "newPasswordTip": "New password should be different",
72
78
  "newValue": "New value",
73
79
  "no": "No",
74
80
  "noChanges": "No changes yet",
@@ -81,6 +87,9 @@
81
87
  "openMenu": "Open menu",
82
88
  "operationSucceeded": "Operation succeeded",
83
89
  "pageNotFound": "Page Not Found",
90
+ "passwordChangeSuccess": "Password changed successfully, please sign in again",
91
+ "passwordRepeatError": "The two passwords entered are inconsistent",
92
+ "passwordTip": "The password cannot be less than 6 characters and contains at least one letter and number",
84
93
  "prompt": "Input",
85
94
  "pullToRefresh": "Pull down to refresh",
86
95
  "quarters": ["Q1", "Q2", "Q3", "Q4"],
@@ -91,6 +100,8 @@
91
100
  "reloginTip": "Please enter your password, resubmit the data after successful login",
92
101
  "remove": "Remove",
93
102
  "renew": "Renew",
103
+ "repeatPassword": "Repeat the password",
104
+ "repeatPasswordRequired": "Please repeat the new password",
94
105
  "reports": "Reports",
95
106
  "requiredField": "{0} is a required field",
96
107
  "resending": "Resending",
@@ -148,6 +159,7 @@
148
159
  "updateReady": "Update ready",
149
160
  "updateTip": "Restart the application to use the latest features",
150
161
  "user": "User",
162
+ "users": "Users",
151
163
  "view": "View",
152
164
  "warning": "Warning",
153
165
  "welcome": "{0}, welcome!"
@@ -2,12 +2,13 @@
2
2
  "accountant": "会计",
3
3
  "actions": "操作",
4
4
  "add": "添加",
5
- "audits": "稽核历史",
5
+ "audits": "操作历史",
6
6
  "authorizer": "授权人",
7
7
  "applicant": "申请人",
8
8
  "approve": "批准",
9
9
  "back": "后退",
10
10
  "cancel": "取消",
11
+ "changePassword": "修改密码",
11
12
  "clear": "清除",
12
13
  "close": "关闭",
13
14
  "confirm": "确认",
@@ -15,6 +16,8 @@
15
16
  "completeTip": "已完成 {0}",
16
17
  "copy": "复制",
17
18
  "creation": "登记时间",
19
+ "currentPassword": "当前密码",
20
+ "currentPasswordRequired": "请输入现在使用的密码",
18
21
  "currency": "币种",
19
22
  "currencyAUD": "澳元$",
20
23
  "currencyCAD": "加元$",
@@ -69,6 +72,9 @@
69
72
  "more": "更多",
70
73
  "moreTag": "({0}+)",
71
74
  "name": "姓名",
75
+ "newPassword": "新密码",
76
+ "newPasswordRequired": "请输入新密码",
77
+ "newPasswordTip": "请设置一个和现在的密码不一样的新密码",
72
78
  "newValue": "新值",
73
79
  "no": "否",
74
80
  "noChanges": "还没有任何修改",
@@ -81,6 +87,9 @@
81
87
  "openMenu": "打开菜单",
82
88
  "operationSucceeded": "操作成功",
83
89
  "pageNotFound": "找不到页面",
90
+ "passwordChangeSuccess": "密码修改成功,请重新登录",
91
+ "passwordRepeatError": "两次输入的密码不一致",
92
+ "passwordTip": "密码不能少于6个字符,且至少包含一个字母和数字",
84
93
  "prompt": "输入",
85
94
  "pullToRefresh": "下拉刷新",
86
95
  "quarters": ["一季度", "二季度", "三季度", "四季度"],
@@ -91,6 +100,8 @@
91
100
  "reloginTip": "请输入您的登录密码,登录成功后请重新提交数据",
92
101
  "remove": "移除",
93
102
  "renew": "续费",
103
+ "repeatPassword": "重复密码",
104
+ "repeatPasswordRequired": "请重复输入新密码",
94
105
  "reports": "统计报表",
95
106
  "requiredField": "'{0}'不能为空",
96
107
  "resending": "重新发送",
@@ -149,6 +160,7 @@
149
160
  "updateReady": "更新就绪",
150
161
  "updateTip": "重新启动应用程序以使用最新功能",
151
162
  "user": "用户",
163
+ "users": "用户",
152
164
  "view": "查看",
153
165
  "warning": "警告",
154
166
  "welcome": "{0}, 欢迎光临!"
@@ -2,12 +2,13 @@
2
2
  "accountant": "會計",
3
3
  "actions": "操作",
4
4
  "add": "添加",
5
- "audits": "稽核歷史",
5
+ "audits": "操作歷史",
6
6
  "authorizer": "授權人",
7
7
  "applicant": "申請人",
8
8
  "approve": "批准",
9
9
  "back": "後退",
10
10
  "cancel": "取消",
11
+ "changePassword": "修改密碼",
11
12
  "clear": "清除",
12
13
  "close": "關閉",
13
14
  "confirm": "確認",
@@ -15,6 +16,8 @@
15
16
  "completeTip": "已完成 {0}",
16
17
  "copy": "複製",
17
18
  "creation": "登記時間",
19
+ "currentPassword": "當前密碼",
20
+ "currentPasswordRequired": "請輸入現在使用的密碼",
18
21
  "currency": "幣種",
19
22
  "currencyAUD": "澳元$",
20
23
  "currencyCAD": "加元$",
@@ -69,6 +72,9 @@
69
72
  "more": "更多",
70
73
  "moreTag": "({0}+)",
71
74
  "name": "姓名",
75
+ "newPassword": "新密碼",
76
+ "newPasswordRequired": "請輸入新密碼",
77
+ "newPasswordTip": "請設置一個和現在的密碼不一樣的新密碼",
72
78
  "newValue": "舊值",
73
79
  "no": "否",
74
80
  "noChanges": "還沒有任何修改",
@@ -81,6 +87,9 @@
81
87
  "openMenu": "打開菜單",
82
88
  "operationSucceeded": "操作成功",
83
89
  "pageNotFound": "找不到頁面",
90
+ "passwordChangeSuccess": "密碼修改成功,請重新登錄",
91
+ "passwordRepeatError": "兩次輸入的密碼不一致",
92
+ "passwordTip": "密碼不能少於6個字符,且至少包含一個字母和數字",
84
93
  "prompt": "輸入",
85
94
  "pullToRefresh": "下拉刷新",
86
95
  "quarters": ["一季度", "二季度", "三季度", "四季度"],
@@ -93,6 +102,8 @@
93
102
  "renew": "續費",
94
103
  "reports": "統計報表",
95
104
  "requiredField": "'{0}'不能為空",
105
+ "repeatPassword": "重複密碼",
106
+ "repeatPasswordRequired": "請重複輸入新密碼",
96
107
  "resending": "重新發送",
97
108
  "reset": "重置",
98
109
  "rotateLeft": "左旋轉90°",
@@ -148,6 +159,7 @@
148
159
  "updateReady": "更新就緒",
149
160
  "updateTip": "重新啟動應用程序以使用最新功能",
150
161
  "user": "用戶",
162
+ "users": "用戶",
151
163
  "view": "查看",
152
164
  "warning": "警告",
153
165
  "welcome": "{0}, 歡迎光臨!"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.63",
3
+ "version": "1.2.66",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -59,15 +59,15 @@
59
59
  "crypto-js": "^4.1.1"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/cli": "^7.18.9",
63
- "@babel/core": "^7.18.9",
64
- "@babel/plugin-transform-runtime": "^7.18.9",
65
- "@babel/preset-env": "^7.18.9",
62
+ "@babel/cli": "^7.18.10",
63
+ "@babel/core": "^7.18.10",
64
+ "@babel/plugin-transform-runtime": "^7.18.10",
65
+ "@babel/preset-env": "^7.18.10",
66
66
  "@babel/runtime-corejs3": "^7.18.9",
67
67
  "@types/jest": "^28.1.6",
68
- "@typescript-eslint/eslint-plugin": "^5.31.0",
69
- "@typescript-eslint/parser": "^5.31.0",
70
- "eslint": "^8.20.0",
68
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
69
+ "@typescript-eslint/parser": "^5.32.0",
70
+ "eslint": "^8.21.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.26.0",
73
73
  "jest": "^28.1.3",
@@ -420,6 +420,12 @@ export interface ICoreApp<
420
420
  resetKeys?: boolean
421
421
  ): Promise<void>;
422
422
 
423
+ /**
424
+ * Is valid password, override to implement custom check
425
+ * @param password Input password
426
+ */
427
+ isValidPassword(password: string): boolean;
428
+
423
429
  /**
424
430
  * Callback where exit a page
425
431
  */
@@ -795,6 +801,22 @@ export abstract class CoreApp<
795
801
  return false;
796
802
  }
797
803
 
804
+ /**
805
+ * Is valid password, override to implement custom check
806
+ * @param password Input password
807
+ */
808
+ isValidPassword(password: string) {
809
+ // Length check
810
+ if (password.length < 6) return false;
811
+
812
+ // One letter and number required
813
+ if (/\d+/gi.test(password) && /[a-z]+/gi.test(password)) {
814
+ return true;
815
+ }
816
+
817
+ return false;
818
+ }
819
+
798
820
  /**
799
821
  * Persist settings to source when application exit
800
822
  */
@@ -862,6 +884,17 @@ export abstract class CoreApp<
862
884
  return await this.api.put<InitCallResult>(this.initCallApi, data);
863
885
  }
864
886
 
887
+ /**
888
+ * Check the action result is about device invalid
889
+ * @param result Action result
890
+ * @returns true means device is invalid
891
+ */
892
+ protected checkDeviceResult(result: IActionResult): boolean {
893
+ if (result.type == 'NoValidData' && result.field == 'Device')
894
+ return true;
895
+ return false;
896
+ }
897
+
865
898
  /**
866
899
  * Init call
867
900
  * @param callback Callback
@@ -870,7 +903,10 @@ export abstract class CoreApp<
870
903
  */
871
904
  async initCall(callback?: (result: boolean) => void, resetKeys?: boolean) {
872
905
  // Reset keys
873
- if (resetKeys) this.resetKeys();
906
+ if (resetKeys) {
907
+ this._deviceId = '';
908
+ this.resetKeys();
909
+ }
874
910
 
875
911
  // Passphrase exists?
876
912
  if (this.passphrase) {
@@ -8,6 +8,7 @@
8
8
  "approve": "Approve it",
9
9
  "back": "Back",
10
10
  "cancel": "Cancel",
11
+ "changePassword": "Change password",
11
12
  "clear": "Clear",
12
13
  "close": "Close",
13
14
  "confirm": "Confirm",
@@ -15,6 +16,8 @@
15
16
  "completeTip": "{0} completed",
16
17
  "copy": "Copy",
17
18
  "creation": "Creation",
19
+ "currentPassword": "Current password",
20
+ "currentPasswordRequired": "Please enter your current password",
18
21
  "currency": "Currency",
19
22
  "currencyAUD": "Australia Dollar $",
20
23
  "currencyCAD": "Canada Dollar $",
@@ -69,6 +72,9 @@
69
72
  "more": "More",
70
73
  "moreTag": "{0} more",
71
74
  "name": "Name",
75
+ "newPassword": "New password",
76
+ "newPasswordRequired": "Please enter your new password",
77
+ "newPasswordTip": "New password should be different",
72
78
  "newValue": "New value",
73
79
  "no": "No",
74
80
  "noChanges": "No changes yet",
@@ -81,6 +87,9 @@
81
87
  "openMenu": "Open menu",
82
88
  "operationSucceeded": "Operation succeeded",
83
89
  "pageNotFound": "Page Not Found",
90
+ "passwordChangeSuccess": "Password changed successfully, please sign in again",
91
+ "passwordRepeatError": "The two passwords entered are inconsistent",
92
+ "passwordTip": "The password cannot be less than 6 characters and contains at least one letter and number",
84
93
  "prompt": "Input",
85
94
  "pullToRefresh": "Pull down to refresh",
86
95
  "quarters": ["Q1", "Q2", "Q3", "Q4"],
@@ -91,6 +100,8 @@
91
100
  "reloginTip": "Please enter your password, resubmit the data after successful login",
92
101
  "remove": "Remove",
93
102
  "renew": "Renew",
103
+ "repeatPassword": "Repeat the password",
104
+ "repeatPasswordRequired": "Please repeat the new password",
94
105
  "reports": "Reports",
95
106
  "requiredField": "{0} is a required field",
96
107
  "resending": "Resending",
@@ -148,6 +159,7 @@
148
159
  "updateReady": "Update ready",
149
160
  "updateTip": "Restart the application to use the latest features",
150
161
  "user": "User",
162
+ "users": "Users",
151
163
  "view": "View",
152
164
  "warning": "Warning",
153
165
  "welcome": "{0}, welcome!"
@@ -2,12 +2,13 @@
2
2
  "accountant": "会计",
3
3
  "actions": "操作",
4
4
  "add": "添加",
5
- "audits": "稽核历史",
5
+ "audits": "操作历史",
6
6
  "authorizer": "授权人",
7
7
  "applicant": "申请人",
8
8
  "approve": "批准",
9
9
  "back": "后退",
10
10
  "cancel": "取消",
11
+ "changePassword": "修改密码",
11
12
  "clear": "清除",
12
13
  "close": "关闭",
13
14
  "confirm": "确认",
@@ -15,6 +16,8 @@
15
16
  "completeTip": "已完成 {0}",
16
17
  "copy": "复制",
17
18
  "creation": "登记时间",
19
+ "currentPassword": "当前密码",
20
+ "currentPasswordRequired": "请输入现在使用的密码",
18
21
  "currency": "币种",
19
22
  "currencyAUD": "澳元$",
20
23
  "currencyCAD": "加元$",
@@ -69,6 +72,9 @@
69
72
  "more": "更多",
70
73
  "moreTag": "({0}+)",
71
74
  "name": "姓名",
75
+ "newPassword": "新密码",
76
+ "newPasswordRequired": "请输入新密码",
77
+ "newPasswordTip": "请设置一个和现在的密码不一样的新密码",
72
78
  "newValue": "新值",
73
79
  "no": "否",
74
80
  "noChanges": "还没有任何修改",
@@ -81,6 +87,9 @@
81
87
  "openMenu": "打开菜单",
82
88
  "operationSucceeded": "操作成功",
83
89
  "pageNotFound": "找不到页面",
90
+ "passwordChangeSuccess": "密码修改成功,请重新登录",
91
+ "passwordRepeatError": "两次输入的密码不一致",
92
+ "passwordTip": "密码不能少于6个字符,且至少包含一个字母和数字",
84
93
  "prompt": "输入",
85
94
  "pullToRefresh": "下拉刷新",
86
95
  "quarters": ["一季度", "二季度", "三季度", "四季度"],
@@ -91,6 +100,8 @@
91
100
  "reloginTip": "请输入您的登录密码,登录成功后请重新提交数据",
92
101
  "remove": "移除",
93
102
  "renew": "续费",
103
+ "repeatPassword": "重复密码",
104
+ "repeatPasswordRequired": "请重复输入新密码",
94
105
  "reports": "统计报表",
95
106
  "requiredField": "'{0}'不能为空",
96
107
  "resending": "重新发送",
@@ -149,6 +160,7 @@
149
160
  "updateReady": "更新就绪",
150
161
  "updateTip": "重新启动应用程序以使用最新功能",
151
162
  "user": "用户",
163
+ "users": "用户",
152
164
  "view": "查看",
153
165
  "warning": "警告",
154
166
  "welcome": "{0}, 欢迎光临!"
@@ -2,12 +2,13 @@
2
2
  "accountant": "會計",
3
3
  "actions": "操作",
4
4
  "add": "添加",
5
- "audits": "稽核歷史",
5
+ "audits": "操作歷史",
6
6
  "authorizer": "授權人",
7
7
  "applicant": "申請人",
8
8
  "approve": "批准",
9
9
  "back": "後退",
10
10
  "cancel": "取消",
11
+ "changePassword": "修改密碼",
11
12
  "clear": "清除",
12
13
  "close": "關閉",
13
14
  "confirm": "確認",
@@ -15,6 +16,8 @@
15
16
  "completeTip": "已完成 {0}",
16
17
  "copy": "複製",
17
18
  "creation": "登記時間",
19
+ "currentPassword": "當前密碼",
20
+ "currentPasswordRequired": "請輸入現在使用的密碼",
18
21
  "currency": "幣種",
19
22
  "currencyAUD": "澳元$",
20
23
  "currencyCAD": "加元$",
@@ -69,6 +72,9 @@
69
72
  "more": "更多",
70
73
  "moreTag": "({0}+)",
71
74
  "name": "姓名",
75
+ "newPassword": "新密碼",
76
+ "newPasswordRequired": "請輸入新密碼",
77
+ "newPasswordTip": "請設置一個和現在的密碼不一樣的新密碼",
72
78
  "newValue": "舊值",
73
79
  "no": "否",
74
80
  "noChanges": "還沒有任何修改",
@@ -81,6 +87,9 @@
81
87
  "openMenu": "打開菜單",
82
88
  "operationSucceeded": "操作成功",
83
89
  "pageNotFound": "找不到頁面",
90
+ "passwordChangeSuccess": "密碼修改成功,請重新登錄",
91
+ "passwordRepeatError": "兩次輸入的密碼不一致",
92
+ "passwordTip": "密碼不能少於6個字符,且至少包含一個字母和數字",
84
93
  "prompt": "輸入",
85
94
  "pullToRefresh": "下拉刷新",
86
95
  "quarters": ["一季度", "二季度", "三季度", "四季度"],
@@ -93,6 +102,8 @@
93
102
  "renew": "續費",
94
103
  "reports": "統計報表",
95
104
  "requiredField": "'{0}'不能為空",
105
+ "repeatPassword": "重複密碼",
106
+ "repeatPasswordRequired": "請重複輸入新密碼",
96
107
  "resending": "重新發送",
97
108
  "reset": "重置",
98
109
  "rotateLeft": "左旋轉90°",
@@ -148,6 +159,7 @@
148
159
  "updateReady": "更新就緒",
149
160
  "updateTip": "重新啟動應用程序以使用最新功能",
150
161
  "user": "用戶",
162
+ "users": "用戶",
151
163
  "view": "查看",
152
164
  "warning": "警告",
153
165
  "welcome": "{0}, 歡迎光臨!"