@nocobase/plugin-users 0.7.0-alpha.6 → 0.7.0-alpha.62
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/lib/actions/users.js +265 -163
- package/lib/collections/roles-users.js +12 -5
- package/lib/collections/users.js +87 -86
- package/lib/index.js +14 -8
- package/lib/jwt-service.js +50 -29
- package/lib/middlewares/check.js +28 -23
- package/lib/middlewares/index.js +20 -7
- package/lib/middlewares/parseToken.js +86 -62
- package/lib/models/UserModel.d.ts +2 -2
- package/lib/models/UserModel.js +68 -53
- package/lib/server.d.ts +5 -10
- package/lib/server.js +253 -149
- package/package.json +3 -8
- package/esm/actions/users.d.ts +0 -11
- package/esm/actions/users.js +0 -165
- package/esm/actions/users.js.map +0 -1
- package/esm/collections/roles-users.d.ts +0 -3
- package/esm/collections/roles-users.js +0 -5
- package/esm/collections/roles-users.js.map +0 -1
- package/esm/collections/users.d.ts +0 -3
- package/esm/collections/users.js +0 -86
- package/esm/collections/users.js.map +0 -1
- package/esm/index.d.ts +0 -1
- package/esm/index.js +0 -2
- package/esm/index.js.map +0 -1
- package/esm/jwt-service.d.ts +0 -12
- package/esm/jwt-service.js +0 -26
- package/esm/jwt-service.js.map +0 -1
- package/esm/middlewares/check.d.ts +0 -1
- package/esm/middlewares/check.js +0 -22
- package/esm/middlewares/check.js.map +0 -1
- package/esm/middlewares/index.d.ts +0 -2
- package/esm/middlewares/index.js +0 -3
- package/esm/middlewares/index.js.map +0 -1
- package/esm/middlewares/parseToken.d.ts +0 -6
- package/esm/middlewares/parseToken.js +0 -64
- package/esm/middlewares/parseToken.js.map +0 -1
- package/esm/models/UserModel.d.ts +0 -4
- package/esm/models/UserModel.js +0 -53
- package/esm/models/UserModel.js.map +0 -1
- package/esm/server.d.ts +0 -23
- package/esm/server.js +0 -133
- package/esm/server.js.map +0 -1
- package/lib/actions/users.js.map +0 -1
- package/lib/collections/roles-users.js.map +0 -1
- package/lib/collections/users.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/jwt-service.js.map +0 -1
- package/lib/middlewares/check.js.map +0 -1
- package/lib/middlewares/index.js.map +0 -1
- package/lib/middlewares/parseToken.js.map +0 -1
- package/lib/models/UserModel.js.map +0 -1
- package/lib/server.js.map +0 -1
- package/tsconfig.build.json +0 -9
package/lib/actions/users.js
CHANGED
|
@@ -1,181 +1,283 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.changePassword = changePassword;
|
|
7
|
+
exports.check = check;
|
|
8
|
+
exports.getUserByResetToken = getUserByResetToken;
|
|
9
|
+
exports.lostpassword = lostpassword;
|
|
10
|
+
exports.resetpassword = resetpassword;
|
|
11
|
+
exports.setDefaultRole = setDefaultRole;
|
|
12
|
+
exports.signin = signin;
|
|
13
|
+
exports.signout = signout;
|
|
14
|
+
exports.signup = signup;
|
|
15
|
+
exports.updateProfile = updateProfile;
|
|
16
|
+
|
|
17
|
+
function _crypto() {
|
|
18
|
+
const data = _interopRequireDefault(require("crypto"));
|
|
19
|
+
|
|
20
|
+
_crypto = function _crypto() {
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
|
+
|
|
29
|
+
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; }
|
|
30
|
+
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
|
+
|
|
33
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
34
|
+
|
|
35
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
36
|
+
|
|
37
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
38
|
+
|
|
39
|
+
function check(_x, _x2) {
|
|
40
|
+
return _check.apply(this, arguments);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function _check() {
|
|
44
|
+
_check = _asyncToGenerator(function* (ctx, next) {
|
|
45
|
+
if (ctx.state.currentUser) {
|
|
46
|
+
const user = ctx.state.currentUser.toJSON();
|
|
47
|
+
ctx.body = user;
|
|
48
|
+
} else {
|
|
49
|
+
ctx.body = {};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
yield next();
|
|
53
|
+
});
|
|
54
|
+
return _check.apply(this, arguments);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function signin(_x3, _x4) {
|
|
58
|
+
return _signin.apply(this, arguments);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function _signin() {
|
|
62
|
+
_signin = _asyncToGenerator(function* (ctx, next) {
|
|
63
|
+
const _ctx$action$params = ctx.action.params,
|
|
64
|
+
_ctx$action$params$un = _ctx$action$params.uniqueField,
|
|
65
|
+
uniqueField = _ctx$action$params$un === void 0 ? 'email' : _ctx$action$params$un,
|
|
66
|
+
values = _ctx$action$params.values;
|
|
67
|
+
|
|
68
|
+
if (!values[uniqueField]) {
|
|
69
|
+
ctx.throw(401, '请填写邮箱账号');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const User = ctx.db.getCollection('users');
|
|
73
|
+
const user = yield User.model.findOne({
|
|
74
|
+
where: {
|
|
75
|
+
[uniqueField]: values[uniqueField]
|
|
76
|
+
}
|
|
9
77
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
78
|
+
|
|
79
|
+
if (!user) {
|
|
80
|
+
ctx.throw(401, '邮箱账号未注册');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const pwd = User.getField('password');
|
|
84
|
+
const isValid = yield pwd.verify(values.password, user.password);
|
|
85
|
+
|
|
86
|
+
if (!isValid) {
|
|
87
|
+
ctx.throw(401, '密码错误,请您重新输入');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const pluginUser = ctx.app.getPlugin('@nocobase/plugin-users');
|
|
91
|
+
ctx.body = _objectSpread(_objectSpread({}, user.toJSON()), {}, {
|
|
92
|
+
token: pluginUser.jwtService.sign({
|
|
93
|
+
userId: user.get('id')
|
|
94
|
+
})
|
|
27
95
|
});
|
|
96
|
+
yield next();
|
|
97
|
+
});
|
|
98
|
+
return _signin.apply(this, arguments);
|
|
28
99
|
}
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
const { uniqueField = 'email', values } = ctx.action.params;
|
|
33
|
-
if (!values[uniqueField]) {
|
|
34
|
-
ctx.throw(401, '请填写邮箱账号');
|
|
35
|
-
}
|
|
36
|
-
const User = ctx.db.getCollection('users');
|
|
37
|
-
const user = yield User.model.findOne({
|
|
38
|
-
where: {
|
|
39
|
-
[uniqueField]: values[uniqueField],
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
if (!user) {
|
|
43
|
-
ctx.throw(401, '邮箱账号未注册');
|
|
44
|
-
}
|
|
45
|
-
const pwd = User.getField('password');
|
|
46
|
-
const isValid = yield pwd.verify(values.password, user.password);
|
|
47
|
-
if (!isValid) {
|
|
48
|
-
ctx.throw(401, '密码错误,请您重新输入');
|
|
49
|
-
}
|
|
50
|
-
const pluginUser = ctx.app.getPlugin('@nocobase/plugin-users');
|
|
51
|
-
ctx.body = Object.assign(Object.assign({}, user.toJSON()), { token: pluginUser.jwtService.sign({
|
|
52
|
-
userId: user.get('id'),
|
|
53
|
-
}) });
|
|
54
|
-
yield next();
|
|
55
|
-
});
|
|
100
|
+
|
|
101
|
+
function signout(_x5, _x6) {
|
|
102
|
+
return _signout.apply(this, arguments);
|
|
56
103
|
}
|
|
57
|
-
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
104
|
+
|
|
105
|
+
function _signout() {
|
|
106
|
+
_signout = _asyncToGenerator(function* (ctx, next) {
|
|
107
|
+
ctx.body = ctx.state.currentUser;
|
|
108
|
+
yield next();
|
|
109
|
+
});
|
|
110
|
+
return _signout.apply(this, arguments);
|
|
63
111
|
}
|
|
64
|
-
|
|
65
|
-
function signup(
|
|
66
|
-
|
|
67
|
-
const User = ctx.db.getRepository('users');
|
|
68
|
-
const { values } = ctx.action.params;
|
|
69
|
-
const user = yield User.create({ values });
|
|
70
|
-
ctx.body = user;
|
|
71
|
-
yield next();
|
|
72
|
-
});
|
|
112
|
+
|
|
113
|
+
function signup(_x7, _x8) {
|
|
114
|
+
return _signup.apply(this, arguments);
|
|
73
115
|
}
|
|
74
|
-
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const User = ctx.db.getCollection('users');
|
|
82
|
-
const user = yield User.model.findOne({
|
|
83
|
-
where: {
|
|
84
|
-
email,
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
if (!user) {
|
|
88
|
-
ctx.throw(401, '邮箱账号未注册');
|
|
89
|
-
}
|
|
90
|
-
user.resetToken = crypto_1.default.randomBytes(20).toString('hex');
|
|
91
|
-
yield user.save();
|
|
92
|
-
ctx.body = user;
|
|
93
|
-
yield next();
|
|
116
|
+
|
|
117
|
+
function _signup() {
|
|
118
|
+
_signup = _asyncToGenerator(function* (ctx, next) {
|
|
119
|
+
const User = ctx.db.getRepository('users');
|
|
120
|
+
const values = ctx.action.params.values;
|
|
121
|
+
const user = yield User.create({
|
|
122
|
+
values
|
|
94
123
|
});
|
|
124
|
+
ctx.body = user;
|
|
125
|
+
yield next();
|
|
126
|
+
});
|
|
127
|
+
return _signup.apply(this, arguments);
|
|
95
128
|
}
|
|
96
|
-
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
const { values: { email, password, resetToken }, } = ctx.action.params;
|
|
100
|
-
const User = ctx.db.getCollection('users');
|
|
101
|
-
const user = yield User.model.findOne({
|
|
102
|
-
where: {
|
|
103
|
-
email,
|
|
104
|
-
resetToken,
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
if (!user) {
|
|
108
|
-
ctx.throw(401, 'Unauthorized');
|
|
109
|
-
}
|
|
110
|
-
user.token = null;
|
|
111
|
-
user.resetToken = null;
|
|
112
|
-
user.password = password;
|
|
113
|
-
yield user.save();
|
|
114
|
-
ctx.body = user;
|
|
115
|
-
yield next();
|
|
116
|
-
});
|
|
129
|
+
|
|
130
|
+
function lostpassword(_x9, _x10) {
|
|
131
|
+
return _lostpassword.apply(this, arguments);
|
|
117
132
|
}
|
|
118
|
-
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
yield next();
|
|
133
|
+
|
|
134
|
+
function _lostpassword() {
|
|
135
|
+
_lostpassword = _asyncToGenerator(function* (ctx, next) {
|
|
136
|
+
const email = ctx.action.params.values.email;
|
|
137
|
+
|
|
138
|
+
if (!email) {
|
|
139
|
+
ctx.throw(401, '请填写邮箱账号');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const User = ctx.db.getCollection('users');
|
|
143
|
+
const user = yield User.model.findOne({
|
|
144
|
+
where: {
|
|
145
|
+
email
|
|
146
|
+
}
|
|
133
147
|
});
|
|
148
|
+
|
|
149
|
+
if (!user) {
|
|
150
|
+
ctx.throw(401, '邮箱账号未注册');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
user.resetToken = _crypto().default.randomBytes(20).toString('hex');
|
|
154
|
+
yield user.save();
|
|
155
|
+
ctx.body = user;
|
|
156
|
+
yield next();
|
|
157
|
+
});
|
|
158
|
+
return _lostpassword.apply(this, arguments);
|
|
134
159
|
}
|
|
135
|
-
|
|
136
|
-
function
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
160
|
+
|
|
161
|
+
function resetpassword(_x11, _x12) {
|
|
162
|
+
return _resetpassword.apply(this, arguments);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function _resetpassword() {
|
|
166
|
+
_resetpassword = _asyncToGenerator(function* (ctx, next) {
|
|
167
|
+
const _ctx$action$params$va = ctx.action.params.values,
|
|
168
|
+
email = _ctx$action$params$va.email,
|
|
169
|
+
password = _ctx$action$params$va.password,
|
|
170
|
+
resetToken = _ctx$action$params$va.resetToken;
|
|
171
|
+
const User = ctx.db.getCollection('users');
|
|
172
|
+
const user = yield User.model.findOne({
|
|
173
|
+
where: {
|
|
174
|
+
email,
|
|
175
|
+
resetToken
|
|
176
|
+
}
|
|
145
177
|
});
|
|
178
|
+
|
|
179
|
+
if (!user) {
|
|
180
|
+
ctx.throw(401, 'Unauthorized');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
user.token = null;
|
|
184
|
+
user.resetToken = null;
|
|
185
|
+
user.password = password;
|
|
186
|
+
yield user.save();
|
|
187
|
+
ctx.body = user;
|
|
188
|
+
yield next();
|
|
189
|
+
});
|
|
190
|
+
return _resetpassword.apply(this, arguments);
|
|
146
191
|
}
|
|
147
|
-
|
|
148
|
-
function
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const pwd = User.getField('password');
|
|
161
|
-
const isValid = yield pwd.verify(oldPassword, user.password);
|
|
162
|
-
if (!isValid) {
|
|
163
|
-
ctx.throw(401, '密码错误,请您重新输入');
|
|
164
|
-
}
|
|
165
|
-
user.password = newPassword;
|
|
166
|
-
user.save();
|
|
167
|
-
ctx.body = ctx.state.currentUser.toJSON();
|
|
168
|
-
yield next();
|
|
192
|
+
|
|
193
|
+
function getUserByResetToken(_x13, _x14) {
|
|
194
|
+
return _getUserByResetToken.apply(this, arguments);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function _getUserByResetToken() {
|
|
198
|
+
_getUserByResetToken = _asyncToGenerator(function* (ctx, next) {
|
|
199
|
+
const token = ctx.action.params.token;
|
|
200
|
+
const User = ctx.db.getCollection('users');
|
|
201
|
+
const user = yield User.model.findOne({
|
|
202
|
+
where: {
|
|
203
|
+
resetToken: token
|
|
204
|
+
}
|
|
169
205
|
});
|
|
206
|
+
|
|
207
|
+
if (!user) {
|
|
208
|
+
ctx.throw(401, 'Unauthorized');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
ctx.body = user;
|
|
212
|
+
yield next();
|
|
213
|
+
});
|
|
214
|
+
return _getUserByResetToken.apply(this, arguments);
|
|
170
215
|
}
|
|
171
|
-
|
|
172
|
-
function
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
216
|
+
|
|
217
|
+
function updateProfile(_x15, _x16) {
|
|
218
|
+
return _updateProfile.apply(this, arguments);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function _updateProfile() {
|
|
222
|
+
_updateProfile = _asyncToGenerator(function* (ctx, next) {
|
|
223
|
+
const values = ctx.action.params.values;
|
|
224
|
+
|
|
225
|
+
if (!ctx.state.currentUser) {
|
|
226
|
+
ctx.throw(401, 'Unauthorized');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
yield ctx.state.currentUser.update(values);
|
|
230
|
+
ctx.body = ctx.state.currentUser;
|
|
231
|
+
yield next();
|
|
232
|
+
});
|
|
233
|
+
return _updateProfile.apply(this, arguments);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function changePassword(_x17, _x18) {
|
|
237
|
+
return _changePassword.apply(this, arguments);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function _changePassword() {
|
|
241
|
+
_changePassword = _asyncToGenerator(function* (ctx, next) {
|
|
242
|
+
const _ctx$action$params$va2 = ctx.action.params.values,
|
|
243
|
+
oldPassword = _ctx$action$params$va2.oldPassword,
|
|
244
|
+
newPassword = _ctx$action$params$va2.newPassword;
|
|
245
|
+
|
|
246
|
+
if (!ctx.state.currentUser) {
|
|
247
|
+
ctx.throw(401, 'Unauthorized');
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const User = ctx.db.getCollection('users');
|
|
251
|
+
const user = yield User.model.findOne({
|
|
252
|
+
where: {
|
|
253
|
+
email: ctx.state.currentUser.email
|
|
254
|
+
}
|
|
178
255
|
});
|
|
256
|
+
const pwd = User.getField('password');
|
|
257
|
+
const isValid = yield pwd.verify(oldPassword, user.password);
|
|
258
|
+
|
|
259
|
+
if (!isValid) {
|
|
260
|
+
ctx.throw(401, '密码错误,请您重新输入');
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
user.password = newPassword;
|
|
264
|
+
user.save();
|
|
265
|
+
ctx.body = ctx.state.currentUser.toJSON();
|
|
266
|
+
yield next();
|
|
267
|
+
});
|
|
268
|
+
return _changePassword.apply(this, arguments);
|
|
179
269
|
}
|
|
180
|
-
|
|
181
|
-
|
|
270
|
+
|
|
271
|
+
function setDefaultRole(_x19, _x20) {
|
|
272
|
+
return _setDefaultRole.apply(this, arguments);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function _setDefaultRole() {
|
|
276
|
+
_setDefaultRole = _asyncToGenerator(function* (ctx, next) {
|
|
277
|
+
const roleName = ctx.action.params.values.roleName;
|
|
278
|
+
yield ctx.state.currentUser.setDefaultRole(roleName);
|
|
279
|
+
ctx.body = 'ok';
|
|
280
|
+
yield next();
|
|
281
|
+
});
|
|
282
|
+
return _setDefaultRole.apply(this, arguments);
|
|
283
|
+
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
name: 'rolesUsers',
|
|
9
|
+
fields: [{
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
name: 'default'
|
|
12
|
+
}]
|
|
6
13
|
};
|
|
7
|
-
|
|
14
|
+
exports.default = _default;
|
package/lib/collections/users.js
CHANGED
|
@@ -1,88 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
name: 'users',
|
|
9
|
+
title: '{{t("Users")}}',
|
|
10
|
+
sortable: 'sort',
|
|
11
|
+
model: 'UserModel',
|
|
12
|
+
createdBy: true,
|
|
13
|
+
updatedBy: true,
|
|
14
|
+
fields: [{
|
|
15
|
+
name: 'id',
|
|
16
|
+
type: 'integer',
|
|
17
|
+
autoIncrement: true,
|
|
18
|
+
primaryKey: true,
|
|
19
|
+
allowNull: false,
|
|
20
|
+
uiSchema: {
|
|
21
|
+
type: 'number',
|
|
22
|
+
title: '{{t("ID")}}',
|
|
23
|
+
'x-component': 'InputNumber',
|
|
24
|
+
'x-read-pretty': true
|
|
25
|
+
},
|
|
26
|
+
interface: 'id'
|
|
27
|
+
}, {
|
|
28
|
+
interface: 'input',
|
|
29
|
+
type: 'string',
|
|
30
|
+
name: 'nickname',
|
|
31
|
+
uiSchema: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
title: '{{t("Nickname")}}',
|
|
34
|
+
'x-component': 'Input'
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
interface: 'email',
|
|
38
|
+
type: 'string',
|
|
39
|
+
name: 'email',
|
|
40
|
+
unique: true,
|
|
41
|
+
uiSchema: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
title: '{{t("Email")}}',
|
|
44
|
+
'x-component': 'Input',
|
|
45
|
+
require: true
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
interface: 'password',
|
|
49
|
+
type: 'password',
|
|
50
|
+
name: 'password',
|
|
51
|
+
hidden: true,
|
|
52
|
+
uiSchema: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
title: '{{t("Password")}}',
|
|
55
|
+
'x-component': 'Password'
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
interface: 'linkTo',
|
|
59
|
+
type: 'belongsToMany',
|
|
60
|
+
name: 'roles',
|
|
61
|
+
target: 'roles',
|
|
62
|
+
foreignKey: 'userId',
|
|
63
|
+
otherKey: 'roleName',
|
|
64
|
+
sourceKey: 'id',
|
|
65
|
+
targetKey: 'name',
|
|
66
|
+
through: 'rolesUsers',
|
|
67
|
+
uiSchema: {
|
|
68
|
+
type: 'array',
|
|
69
|
+
title: '{{t("Roles")}}',
|
|
70
|
+
'x-component': 'RecordPicker',
|
|
71
|
+
'x-component-props': {
|
|
72
|
+
multiple: true,
|
|
73
|
+
fieldNames: {
|
|
74
|
+
label: 'title',
|
|
75
|
+
value: 'name'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
type: 'string',
|
|
81
|
+
name: 'appLang'
|
|
82
|
+
}, {
|
|
83
|
+
type: 'string',
|
|
84
|
+
name: 'resetToken',
|
|
85
|
+
unique: true,
|
|
86
|
+
hidden: true
|
|
87
|
+
}]
|
|
87
88
|
};
|
|
88
|
-
|
|
89
|
+
exports.default = _default;
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _server.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _server = _interopRequireDefault(require("./server"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|