@nocobase/plugin-verification 0.10.0-alpha.5 → 0.11.0-alpha.1
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/client.d.ts +2 -3
- package/client.js +1 -30
- package/lib/client/ProviderOptions.js +15 -15
- package/lib/client/VerificationProvider.d.ts +3 -0
- package/lib/client/VerificationProvider.js +59 -0
- package/lib/client/index.d.ts +5 -3
- package/lib/client/index.js +15 -46
- package/lib/server/actions/verifications.js +16 -16
- package/package.json +28 -9
- package/server.d.ts +2 -3
- package/server.js +1 -30
- package/src/client/ProviderOptions.tsx +3 -3
- package/src/client/VerificationProvider.tsx +39 -0
- package/src/client/index.tsx +8 -37
- package/src/server/actions/verifications.ts +4 -6
package/client.d.ts
CHANGED
package/client.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
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); }
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
|
-
var _index = _interopRequireWildcard(require("./lib/client"));
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
var _exportNames = {};
|
|
13
|
-
Object.defineProperty(exports, "default", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _index.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.keys(_index).forEach(function (key) {
|
|
21
|
-
if (key === "default" || key === "__esModule") return;
|
|
22
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
-
Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _index[key];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
1
|
+
module.exports = require('./lib/client/index.js');
|
|
@@ -4,22 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data =
|
|
9
|
-
|
|
7
|
+
function _antdV() {
|
|
8
|
+
const data = require("@formily/antd-v5");
|
|
9
|
+
_antdV = function _antdV() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data = require("@formily/
|
|
16
|
-
|
|
14
|
+
function _react() {
|
|
15
|
+
const data = require("@formily/react");
|
|
16
|
+
_react = function _react() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
21
|
function _react2() {
|
|
22
|
-
const data = require("
|
|
22
|
+
const data = _interopRequireWildcard(require("react"));
|
|
23
23
|
_react2 = function _react2() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
@@ -35,20 +35,20 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
35
35
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
36
36
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
37
37
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
38
|
-
const Verification = (0,
|
|
39
|
-
const form = (0,
|
|
40
|
-
const field = (0,
|
|
41
|
-
const _useState = (0,
|
|
38
|
+
const Verification = (0, _react().observer)(props => {
|
|
39
|
+
const form = (0, _react().useForm)();
|
|
40
|
+
const field = (0, _react().useField)();
|
|
41
|
+
const _useState = (0, _react2().useState)(new (_react().Schema)({})),
|
|
42
42
|
_useState2 = _slicedToArray(_useState, 2),
|
|
43
43
|
s = _useState2[0],
|
|
44
44
|
setSchema = _useState2[1];
|
|
45
|
-
(0,
|
|
45
|
+
(0, _react2().useEffect)(() => {
|
|
46
46
|
form.clearFormGraph('options.*');
|
|
47
|
-
setSchema(new (
|
|
47
|
+
setSchema(new (_react().Schema)(_providerTypes.default.get(form.values.type) || {}));
|
|
48
48
|
}, [form.values.type]);
|
|
49
|
-
return
|
|
49
|
+
return _react2().default.createElement(_antdV().FormLayout, {
|
|
50
50
|
layout: 'vertical'
|
|
51
|
-
},
|
|
51
|
+
}, _react2().default.createElement(_react().RecursionField, {
|
|
52
52
|
key: form.values.type || 'sms-aliyun',
|
|
53
53
|
basePath: field.address,
|
|
54
54
|
onlyRenderProperties: true,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VerificationProvider = void 0;
|
|
7
|
+
Object.defineProperty(exports, "verificationProviderTypes", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _providerTypes.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
function _react() {
|
|
14
|
+
const data = _interopRequireWildcard(require("react"));
|
|
15
|
+
_react = function _react() {
|
|
16
|
+
return data;
|
|
17
|
+
};
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
function _client() {
|
|
21
|
+
const data = require("@nocobase/client");
|
|
22
|
+
_client = function _client() {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
var _locale = require("./locale");
|
|
28
|
+
var _VerificationProviders = require("./VerificationProviders");
|
|
29
|
+
var _providerTypes = _interopRequireDefault(require("./providerTypes"));
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
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); }
|
|
32
|
+
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; }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
35
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
36
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
37
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
38
|
+
const VerificationProvider = props => {
|
|
39
|
+
const ctx = (0, _react().useContext)(_client().PluginManagerContext);
|
|
40
|
+
return _react().default.createElement(_client().SettingsCenterProvider, {
|
|
41
|
+
settings: {
|
|
42
|
+
verification: {
|
|
43
|
+
icon: 'CheckCircleOutlined',
|
|
44
|
+
title: `{{t("Verification", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
45
|
+
tabs: {
|
|
46
|
+
providers: {
|
|
47
|
+
title: `{{t("Verification providers", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
48
|
+
component: _VerificationProviders.VerificationProviders
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, _react().default.createElement(_client().PluginManagerContext.Provider, {
|
|
54
|
+
value: {
|
|
55
|
+
components: _objectSpread({}, ctx === null || ctx === void 0 ? void 0 : ctx.components)
|
|
56
|
+
}
|
|
57
|
+
}, props.children));
|
|
58
|
+
};
|
|
59
|
+
exports.VerificationProvider = VerificationProvider;
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { Plugin } from '@nocobase/client';
|
|
2
|
+
export declare class VerificationPlugin extends Plugin {
|
|
3
|
+
load(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export default VerificationPlugin;
|
package/lib/client/index.js
CHANGED
|
@@ -3,20 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
7
|
-
Object.defineProperty(exports, "verificationProviderTypes", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _providerTypes.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
function _react() {
|
|
14
|
-
const data = _interopRequireWildcard(require("react"));
|
|
15
|
-
_react = function _react() {
|
|
16
|
-
return data;
|
|
17
|
-
};
|
|
18
|
-
return data;
|
|
19
|
-
}
|
|
6
|
+
exports.default = exports.VerificationPlugin = void 0;
|
|
20
7
|
function _client() {
|
|
21
8
|
const data = require("@nocobase/client");
|
|
22
9
|
_client = function _client() {
|
|
@@ -24,35 +11,17 @@ function _client() {
|
|
|
24
11
|
};
|
|
25
12
|
return data;
|
|
26
13
|
}
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
settings: {
|
|
42
|
-
verification: {
|
|
43
|
-
icon: 'CheckCircleOutlined',
|
|
44
|
-
title: `{{t("Verification", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
45
|
-
tabs: {
|
|
46
|
-
providers: {
|
|
47
|
-
title: `{{t("Verification providers", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
48
|
-
component: _VerificationProviders.VerificationProviders
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}, _react().default.createElement(_client().PluginManagerContext.Provider, {
|
|
54
|
-
value: {
|
|
55
|
-
components: _objectSpread({}, ctx === null || ctx === void 0 ? void 0 : ctx.components)
|
|
56
|
-
}
|
|
57
|
-
}, props.children));
|
|
58
|
-
}
|
|
14
|
+
var _VerificationProvider = require("./VerificationProvider");
|
|
15
|
+
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); } }
|
|
16
|
+
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); }); }; }
|
|
17
|
+
class VerificationPlugin extends _client().Plugin {
|
|
18
|
+
load() {
|
|
19
|
+
var _this = this;
|
|
20
|
+
return _asyncToGenerator(function* () {
|
|
21
|
+
_this.app.use(_VerificationProvider.VerificationProvider);
|
|
22
|
+
})();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.VerificationPlugin = VerificationPlugin;
|
|
26
|
+
var _default = VerificationPlugin;
|
|
27
|
+
exports.default = _default;
|
|
@@ -4,37 +4,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.create = create;
|
|
7
|
-
function
|
|
8
|
-
const data = require("
|
|
9
|
-
|
|
7
|
+
function _actions() {
|
|
8
|
+
const data = _interopRequireDefault(require("@nocobase/actions"));
|
|
9
|
+
_actions = function _actions() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data = require("
|
|
16
|
-
|
|
14
|
+
function _database() {
|
|
15
|
+
const data = require("@nocobase/database");
|
|
16
|
+
_database = function _database() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const data =
|
|
23
|
-
|
|
21
|
+
function _utils() {
|
|
22
|
+
const data = require("@nocobase/utils");
|
|
23
|
+
_utils = function _utils() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const data = require("
|
|
30
|
-
|
|
28
|
+
function _crypto() {
|
|
29
|
+
const data = require("crypto");
|
|
30
|
+
_crypto = function _crypto() {
|
|
31
31
|
return data;
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const data =
|
|
37
|
-
|
|
35
|
+
function _util() {
|
|
36
|
+
const data = require("util");
|
|
37
|
+
_util = function _util() {
|
|
38
38
|
return data;
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
@@ -83,7 +83,7 @@ function _create() {
|
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
if (record) {
|
|
86
|
-
const seconds = (0,
|
|
86
|
+
const seconds = (0, _utils().dayjs)(record.get('expiresAt')).diff((0, _utils().dayjs)(), 'seconds');
|
|
87
87
|
// return context.throw(429, { code: 'RateLimit', message: context.t('Please don\'t retry in {{time}}', { time: moment().locale('zh').to(record.get('expiresAt')) }) });
|
|
88
88
|
return context.throw(429, {
|
|
89
89
|
code: 'RateLimit',
|
package/package.json
CHANGED
|
@@ -4,22 +4,41 @@
|
|
|
4
4
|
"displayName.zh-CN": "验证码",
|
|
5
5
|
"description": "verification setting.",
|
|
6
6
|
"description.zh-CN": "验证码配置。",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.11.0-alpha.1",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
|
-
"main": "./lib/index.js",
|
|
10
|
-
"
|
|
9
|
+
"main": "./lib/server/index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib",
|
|
12
|
+
"src",
|
|
13
|
+
"README.md",
|
|
14
|
+
"README.zh-CN.md",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"server.js",
|
|
17
|
+
"server.d.ts",
|
|
18
|
+
"client.js",
|
|
19
|
+
"client.d.ts"
|
|
20
|
+
],
|
|
11
21
|
"dependencies": {
|
|
12
22
|
"@alicloud/dysmsapi20170525": "2.0.17",
|
|
13
23
|
"@alicloud/openapi-client": "0.4.1",
|
|
14
24
|
"@alicloud/tea-util": "1.4.4",
|
|
15
|
-
"@nocobase/actions": "0.10.0-alpha.5",
|
|
16
|
-
"@nocobase/resourcer": "0.10.0-alpha.5",
|
|
17
|
-
"@nocobase/server": "0.10.0-alpha.5",
|
|
18
|
-
"@nocobase/utils": "0.10.0-alpha.5",
|
|
19
25
|
"tencentcloud-sdk-nodejs": "^4.0.525"
|
|
20
26
|
},
|
|
21
27
|
"devDependencies": {
|
|
22
|
-
"@
|
|
28
|
+
"@formily/antd-v5": "1.1.0-beta.4",
|
|
29
|
+
"@formily/core": "2.2.26",
|
|
30
|
+
"@formily/react": "2.2.26",
|
|
31
|
+
"@formily/shared": "2.2.26",
|
|
32
|
+
"@nocobase/actions": "0.11.0-alpha.1",
|
|
33
|
+
"@nocobase/client": "0.11.0-alpha.1",
|
|
34
|
+
"@nocobase/database": "0.11.0-alpha.1",
|
|
35
|
+
"@nocobase/resourcer": "0.11.0-alpha.1",
|
|
36
|
+
"@nocobase/server": "0.11.0-alpha.1",
|
|
37
|
+
"@nocobase/test": "0.11.0-alpha.1",
|
|
38
|
+
"@nocobase/utils": "0.11.0-alpha.1",
|
|
39
|
+
"antd": "^5.6.4",
|
|
40
|
+
"react": "18.x",
|
|
41
|
+
"react-i18next": "^11.15.1"
|
|
23
42
|
},
|
|
24
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "7581b6d3a3a54f09f06a9effb7e3e65328281b2b"
|
|
25
44
|
}
|
package/server.d.ts
CHANGED
package/server.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
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); }
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
|
-
var _index = _interopRequireWildcard(require("./lib/server"));
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
var _exportNames = {};
|
|
13
|
-
Object.defineProperty(exports, "default", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _index.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.keys(_index).forEach(function (key) {
|
|
21
|
-
if (key === "default" || key === "__esModule") return;
|
|
22
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
-
Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _index[key];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
1
|
+
module.exports = require('./lib/server/index.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FormLayout } from '@formily/antd';
|
|
1
|
+
import { FormLayout } from '@formily/antd-v5';
|
|
3
2
|
import { Field } from '@formily/core';
|
|
4
|
-
import {
|
|
3
|
+
import { RecursionField, Schema, observer, useField, useForm } from '@formily/react';
|
|
4
|
+
import React, { useEffect, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import providerTypes from './providerTypes';
|
|
7
7
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
import { PluginManagerContext, SettingsCenterProvider } from '@nocobase/client';
|
|
4
|
+
|
|
5
|
+
import { NAMESPACE } from './locale';
|
|
6
|
+
|
|
7
|
+
import { VerificationProviders } from './VerificationProviders';
|
|
8
|
+
|
|
9
|
+
export { default as verificationProviderTypes } from './providerTypes';
|
|
10
|
+
|
|
11
|
+
export const VerificationProvider: FC = (props) => {
|
|
12
|
+
const ctx = useContext(PluginManagerContext);
|
|
13
|
+
return (
|
|
14
|
+
<SettingsCenterProvider
|
|
15
|
+
settings={{
|
|
16
|
+
verification: {
|
|
17
|
+
icon: 'CheckCircleOutlined',
|
|
18
|
+
title: `{{t("Verification", { ns: "${NAMESPACE}" })}}`,
|
|
19
|
+
tabs: {
|
|
20
|
+
providers: {
|
|
21
|
+
title: `{{t("Verification providers", { ns: "${NAMESPACE}" })}}`,
|
|
22
|
+
component: VerificationProviders,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<PluginManagerContext.Provider
|
|
29
|
+
value={{
|
|
30
|
+
components: {
|
|
31
|
+
...ctx?.components,
|
|
32
|
+
},
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
{props.children}
|
|
36
|
+
</PluginManagerContext.Provider>
|
|
37
|
+
</SettingsCenterProvider>
|
|
38
|
+
);
|
|
39
|
+
};
|
package/src/client/index.tsx
CHANGED
|
@@ -1,39 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Plugin } from '@nocobase/client';
|
|
2
|
+
import { VerificationProvider } from './VerificationProvider';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { VerificationProviders } from './VerificationProviders';
|
|
8
|
-
|
|
9
|
-
export { default as verificationProviderTypes } from './providerTypes';
|
|
10
|
-
|
|
11
|
-
export default function (props) {
|
|
12
|
-
const ctx = useContext(PluginManagerContext);
|
|
13
|
-
return (
|
|
14
|
-
<SettingsCenterProvider
|
|
15
|
-
settings={{
|
|
16
|
-
verification: {
|
|
17
|
-
icon: 'CheckCircleOutlined',
|
|
18
|
-
title: `{{t("Verification", { ns: "${NAMESPACE}" })}}`,
|
|
19
|
-
tabs: {
|
|
20
|
-
providers: {
|
|
21
|
-
title: `{{t("Verification providers", { ns: "${NAMESPACE}" })}}`,
|
|
22
|
-
component: VerificationProviders,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
<PluginManagerContext.Provider
|
|
29
|
-
value={{
|
|
30
|
-
components: {
|
|
31
|
-
...ctx?.components,
|
|
32
|
-
},
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
{props.children}
|
|
36
|
-
</PluginManagerContext.Provider>
|
|
37
|
-
</SettingsCenterProvider>
|
|
38
|
-
);
|
|
4
|
+
export class VerificationPlugin extends Plugin {
|
|
5
|
+
async load() {
|
|
6
|
+
this.app.use(VerificationProvider);
|
|
7
|
+
}
|
|
39
8
|
}
|
|
9
|
+
|
|
10
|
+
export default VerificationPlugin;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { randomInt, randomUUID } from 'crypto';
|
|
2
|
-
import { promisify } from 'util';
|
|
3
|
-
|
|
4
1
|
import actions, { Context, Next } from '@nocobase/actions';
|
|
5
2
|
import { Op } from '@nocobase/database';
|
|
6
|
-
|
|
7
|
-
import
|
|
3
|
+
import { dayjs } from '@nocobase/utils';
|
|
4
|
+
import { randomInt, randomUUID } from 'crypto';
|
|
5
|
+
import { promisify } from 'util';
|
|
8
6
|
import Plugin, { namespace } from '..';
|
|
9
7
|
import { CODE_STATUS_UNUSED } from '../constants';
|
|
10
8
|
|
|
@@ -44,7 +42,7 @@ export async function create(context: Context, next: Next) {
|
|
|
44
42
|
},
|
|
45
43
|
});
|
|
46
44
|
if (record) {
|
|
47
|
-
const seconds =
|
|
45
|
+
const seconds = dayjs(record.get('expiresAt')).diff(dayjs(), 'seconds');
|
|
48
46
|
// return context.throw(429, { code: 'RateLimit', message: context.t('Please don\'t retry in {{time}}', { time: moment().locale('zh').to(record.get('expiresAt')) }) });
|
|
49
47
|
return context.throw(429, {
|
|
50
48
|
code: 'RateLimit',
|