@nocobase/plugin-users 0.7.0-alpha.61 → 0.7.0-alpha.64

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.
@@ -24,6 +24,8 @@ function _crypto() {
24
24
  return data;
25
25
  }
26
26
 
27
+ var _ = require("../");
28
+
27
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
30
 
29
31
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -66,7 +68,9 @@ function _signin() {
66
68
  values = _ctx$action$params.values;
67
69
 
68
70
  if (!values[uniqueField]) {
69
- ctx.throw(401, '请填写邮箱账号');
71
+ ctx.throw(401, ctx.t('Please fill in your email address', {
72
+ ns: _.namespace
73
+ }));
70
74
  }
71
75
 
72
76
  const User = ctx.db.getCollection('users');
@@ -77,14 +81,18 @@ function _signin() {
77
81
  });
78
82
 
79
83
  if (!user) {
80
- ctx.throw(401, '邮箱账号未注册');
84
+ ctx.throw(401, ctx.t('The email is incorrect, please re-enter', {
85
+ ns: _.namespace
86
+ }));
81
87
  }
82
88
 
83
89
  const pwd = User.getField('password');
84
90
  const isValid = yield pwd.verify(values.password, user.password);
85
91
 
86
92
  if (!isValid) {
87
- ctx.throw(401, '密码错误,请您重新输入');
93
+ ctx.throw(401, ctx.t('The password is incorrect, please re-enter', {
94
+ ns: _.namespace
95
+ }));
88
96
  }
89
97
 
90
98
  const pluginUser = ctx.app.getPlugin('@nocobase/plugin-users');
@@ -136,7 +144,9 @@ function _lostpassword() {
136
144
  const email = ctx.action.params.values.email;
137
145
 
138
146
  if (!email) {
139
- ctx.throw(401, '请填写邮箱账号');
147
+ ctx.throw(401, ctx.t('Please fill in your email address', {
148
+ ns: _.namespace
149
+ }));
140
150
  }
141
151
 
142
152
  const User = ctx.db.getCollection('users');
@@ -147,7 +157,9 @@ function _lostpassword() {
147
157
  });
148
158
 
149
159
  if (!user) {
150
- ctx.throw(401, '邮箱账号未注册');
160
+ ctx.throw(401, ctx.t('The email is incorrect, please re-enter', {
161
+ ns: _.namespace
162
+ }));
151
163
  }
152
164
 
153
165
  user.resetToken = _crypto().default.randomBytes(20).toString('hex');
@@ -257,7 +269,9 @@ function _changePassword() {
257
269
  const isValid = yield pwd.verify(oldPassword, user.password);
258
270
 
259
271
  if (!isValid) {
260
- ctx.throw(401, '密码错误,请您重新输入');
272
+ ctx.throw(401, ctx.t('The password is incorrect, please re-enter', {
273
+ ns: _.namespace
274
+ }));
261
275
  }
262
276
 
263
277
  user.password = newPassword;
package/lib/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { default } from './server';
2
+ export declare const namespace: any;
package/lib/index.js CHANGED
@@ -9,7 +9,12 @@ Object.defineProperty(exports, "default", {
9
9
  return _server.default;
10
10
  }
11
11
  });
12
+ exports.namespace = void 0;
12
13
 
13
14
  var _server = _interopRequireDefault(require("./server"));
14
15
 
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ const namespace = require('../package.json').name;
19
+
20
+ exports.namespace = namespace;
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ 'Please fill in your email address': string;
3
+ 'The password is incorrect, please re-enter': string;
4
+ };
5
+ export default _default;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ 'Please fill in your email address': 'Please fill in your email address',
9
+ 'The password is incorrect, please re-enter': 'The password is incorrect, please re-enter'
10
+ };
11
+ exports.default = _default;
@@ -0,0 +1,2 @@
1
+ export { default as enUS } from './en-US';
2
+ export { default as zhCN } from './zh-CN';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "enUS", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _enUS.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "zhCN", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _zhCN.default;
16
+ }
17
+ });
18
+
19
+ var _enUS = _interopRequireDefault(require("./en-US"));
20
+
21
+ var _zhCN = _interopRequireDefault(require("./zh-CN"));
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ 'The email is incorrect, please re-enter': string;
3
+ 'Please fill in your email address': string;
4
+ 'The password is incorrect, please re-enter': string;
5
+ };
6
+ export default _default;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ 'The email is incorrect, please re-enter': '邮箱错误,请重新输入',
9
+ 'Please fill in your email address': '请填写密码',
10
+ 'The password is incorrect, please re-enter': '密码错误,请重新输入'
11
+ };
12
+ exports.default = _default;
package/lib/server.js CHANGED
@@ -35,10 +35,14 @@ function _path() {
35
35
  return data;
36
36
  }
37
37
 
38
+ var _2 = require("./");
39
+
38
40
  var actions = _interopRequireWildcard(require("./actions/users"));
39
41
 
40
42
  var _jwtService = require("./jwt-service");
41
43
 
44
+ var _locale = require("./locale");
45
+
42
46
  var middlewares = _interopRequireWildcard(require("./middlewares"));
43
47
 
44
48
  var _UserModel = require("./models/UserModel");
@@ -74,6 +78,10 @@ class UsersPlugin extends _server().Plugin {
74
78
  var _this = this;
75
79
 
76
80
  return _asyncToGenerator(function* () {
81
+ _this.app.i18n.addResources('zh-CN', _2.namespace, _locale.zhCN);
82
+
83
+ _this.app.i18n.addResources('en-US', _2.namespace, _locale.enUS);
84
+
77
85
  const cmd = _this.app.findCommand('install');
78
86
 
79
87
  if (cmd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-users",
3
- "version": "0.7.0-alpha.61",
3
+ "version": "0.7.0-alpha.64",
4
4
  "main": "lib/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "licenses": [
@@ -13,8 +13,8 @@
13
13
  "jsonwebtoken": "^8.5.1"
14
14
  },
15
15
  "devDependencies": {
16
- "@nocobase/test": "0.7.0-alpha.61",
16
+ "@nocobase/test": "0.7.0-alpha.64",
17
17
  "@types/jsonwebtoken": "^8.5.8"
18
18
  },
19
- "gitHead": "37c3cdeb3730e3f39b06c5f8685cf862ad40ce9f"
19
+ "gitHead": "35d01a5fb0f0522e263c7fc37bc8384f99424240"
20
20
  }