@nocobase/plugin-users 0.7.7-alpha.1 → 0.8.0-alpha.11

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.
@@ -79,7 +79,7 @@ function signin(_x3, _x4) {
79
79
 
80
80
  function _signin() {
81
81
  _signin = _asyncToGenerator(function* (ctx, next) {
82
- const _ctx$app$getPlugin = ctx.app.getPlugin('@nocobase/plugin-users'),
82
+ const _ctx$app$getPlugin = ctx.app.getPlugin('users'),
83
83
  authenticators = _ctx$app$getPlugin.authenticators,
84
84
  jwtService = _ctx$app$getPlugin.jwtService;
85
85
 
@@ -52,7 +52,7 @@ function _findUserByToken() {
52
52
  return null;
53
53
  }
54
54
 
55
- const _ctx$app$getPlugin = ctx.app.getPlugin('@nocobase/plugin-users'),
55
+ const _ctx$app$getPlugin = ctx.app.getPlugin('users'),
56
56
  jwtService = _ctx$app$getPlugin.jwtService;
57
57
 
58
58
  try {
package/lib/server.d.ts CHANGED
@@ -1,8 +1,9 @@
1
+ import { HandlerType, Middleware } from '@nocobase/resourcer';
1
2
  import { Plugin } from '@nocobase/server';
2
3
  import { Registry } from '@nocobase/utils';
3
- import { HandlerType, Middleware } from '@nocobase/resourcer';
4
4
  import { JwtOptions, JwtService } from './jwt-service';
5
5
  export interface UserPluginConfig {
6
+ name?: string;
6
7
  jwt: JwtOptions;
7
8
  }
8
9
  export default class UsersPlugin extends Plugin<UserPluginConfig> {
@@ -18,5 +19,4 @@ export default class UsersPlugin extends Plugin<UserPluginConfig> {
18
19
  rootNickname: any;
19
20
  };
20
21
  install(options: any): Promise<void>;
21
- getName(): string;
22
22
  }
package/lib/server.js CHANGED
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- function _path() {
9
- const data = require("path");
8
+ function _jsonTemplates() {
9
+ const data = _interopRequireDefault(require("json-templates"));
10
10
 
11
- _path = function _path() {
11
+ _jsonTemplates = function _jsonTemplates() {
12
12
  return data;
13
13
  };
14
14
 
15
15
  return data;
16
16
  }
17
17
 
18
- function _jsonTemplates() {
19
- const data = _interopRequireDefault(require("json-templates"));
18
+ function _path() {
19
+ const data = require("path");
20
20
 
21
- _jsonTemplates = function _jsonTemplates() {
21
+ _path = function _path() {
22
22
  return data;
23
23
  };
24
24
 
@@ -35,30 +35,30 @@ function _database() {
35
35
  return data;
36
36
  }
37
37
 
38
- function _server() {
39
- const data = require("@nocobase/server");
38
+ function _resourcer() {
39
+ const data = require("@nocobase/resourcer");
40
40
 
41
- _server = function _server() {
41
+ _resourcer = function _resourcer() {
42
42
  return data;
43
43
  };
44
44
 
45
45
  return data;
46
46
  }
47
47
 
48
- function _utils() {
49
- const data = require("@nocobase/utils");
48
+ function _server() {
49
+ const data = require("@nocobase/server");
50
50
 
51
- _utils = function _utils() {
51
+ _server = function _server() {
52
52
  return data;
53
53
  };
54
54
 
55
55
  return data;
56
56
  }
57
57
 
58
- function _resourcer() {
59
- const data = require("@nocobase/resourcer");
58
+ function _utils() {
59
+ const data = require("@nocobase/utils");
60
60
 
61
- _resourcer = function _resourcer() {
61
+ _utils = function _utils() {
62
62
  return data;
63
63
  };
64
64
 
@@ -69,14 +69,14 @@ var _2 = require("./");
69
69
 
70
70
  var actions = _interopRequireWildcard(require("./actions/users"));
71
71
 
72
+ var _authenticators = _interopRequireDefault(require("./authenticators"));
73
+
72
74
  var _jwtService = require("./jwt-service");
73
75
 
74
76
  var _locale = require("./locale");
75
77
 
76
78
  var _middlewares = require("./middlewares");
77
79
 
78
- var _authenticators = _interopRequireDefault(require("./authenticators"));
79
-
80
80
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
81
81
 
82
82
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -194,7 +194,9 @@ class UsersPlugin extends _server().Plugin {
194
194
  _this.app.resourcer.registerActionHandler(`users:${key}`, action);
195
195
  }
196
196
 
197
- _this.app.resourcer.use(_this.tokenMiddleware.getHandler());
197
+ _this.app.resourcer.use(_middlewares.parseToken, {
198
+ tag: 'parseToken'
199
+ });
198
200
 
199
201
  const publicActions = ['check', 'signin', 'signup', 'lostpassword', 'resetpassword', 'getUserByResetToken'];
200
202
  const loggedInActions = ['signout', 'updateProfile', 'changePassword'];
@@ -221,7 +223,7 @@ class UsersPlugin extends _server().Plugin {
221
223
 
222
224
  (0, _authenticators.default)(_this2); // TODO(module): should move to preset
223
225
 
224
- const verificationPlugin = _this2.app.getPlugin('@nocobase/plugin-verification');
226
+ const verificationPlugin = _this2.app.getPlugin('verification');
225
227
 
226
228
  if (verificationPlugin && process.env.DEFAULT_SMS_VERIFY_CODE_PROVIDER) {
227
229
  verificationPlugin.interceptors.register('users:signin', {
@@ -376,10 +378,6 @@ class UsersPlugin extends _server().Plugin {
376
378
  })();
377
379
  }
378
380
 
379
- getName() {
380
- return this.getPackageName(__dirname);
381
- }
382
-
383
381
  }
384
382
 
385
383
  exports.default = UsersPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-users",
3
- "version": "0.7.7-alpha.1",
3
+ "version": "0.8.0-alpha.11",
4
4
  "main": "lib/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "licenses": [
@@ -10,17 +10,17 @@
10
10
  }
11
11
  ],
12
12
  "dependencies": {
13
- "@nocobase/actions": "0.7.7-alpha.1",
14
- "@nocobase/database": "0.7.7-alpha.1",
15
- "@nocobase/resourcer": "0.7.7-alpha.1",
16
- "@nocobase/server": "0.7.7-alpha.1",
17
- "@nocobase/utils": "0.7.7-alpha.1",
13
+ "@nocobase/actions": "0.8.0-alpha.11",
14
+ "@nocobase/database": "0.8.0-alpha.11",
15
+ "@nocobase/resourcer": "0.8.0-alpha.11",
16
+ "@nocobase/server": "0.8.0-alpha.11",
17
+ "@nocobase/utils": "0.8.0-alpha.11",
18
18
  "json-templates": "^4.2.0",
19
19
  "jsonwebtoken": "^8.5.1"
20
20
  },
21
21
  "devDependencies": {
22
- "@nocobase/test": "0.7.7-alpha.1",
22
+ "@nocobase/test": "0.8.0-alpha.11",
23
23
  "@types/jsonwebtoken": "^8.5.8"
24
24
  },
25
- "gitHead": "f82374e6f9daaf71ba63eaf156468ea7ddc042da"
25
+ "gitHead": "5c5379e33b9d6f30ca1c45a95504a46b2b878d8c"
26
26
  }