@nocobase/plugin-verification 0.9.4-alpha.1 → 0.10.0-alpha.2
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/client/ProviderOptions.d.ts +2 -2
- package/lib/client/ProviderOptions.js +4 -1
- package/lib/client/VerificationProviders.d.ts +2 -2
- package/lib/client/index.d.ts +2 -2
- package/lib/client/providerTypes/sms-aliyun.d.ts +1 -0
- package/lib/client/providerTypes/sms-tencent.d.ts +1 -0
- package/lib/server/Plugin.js +8 -5
- package/package.json +11 -8
- package/src/client/ProviderOptions.tsx +24 -14
- package/src/server/Plugin.ts +8 -7
- package/lib/client/Shortcut.d.ts +0 -1
- package/lib/client/Shortcut.js +0 -58
- package/src/client/Shortcut.tsx +0 -20
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const Verification: React.MemoExoticComponent<import("@formily/react").ReactFC<unknown>>;
|
|
3
|
+
export default Verification;
|
|
@@ -35,7 +35,7 @@ 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
|
-
|
|
38
|
+
const Verification = (0, _react2().observer)(props => {
|
|
39
39
|
const form = (0, _react2().useForm)();
|
|
40
40
|
const field = (0, _react2().useField)();
|
|
41
41
|
const _useState = (0, _react().useState)(new (_react2().Schema)({})),
|
|
@@ -54,5 +54,8 @@ var _default = (0, _react2().observer)(props => {
|
|
|
54
54
|
onlyRenderProperties: true,
|
|
55
55
|
schema: s
|
|
56
56
|
}));
|
|
57
|
+
}, {
|
|
58
|
+
displayName: 'Verification'
|
|
57
59
|
});
|
|
60
|
+
var _default = Verification;
|
|
58
61
|
exports.default = _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function VerificationProviders(): JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function VerificationProviders(): React.JSX.Element;
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export { default as verificationProviderTypes } from './providerTypes';
|
|
3
|
-
export default function (props: any): JSX.Element;
|
|
3
|
+
export default function (props: any): React.JSX.Element;
|
package/lib/server/Plugin.js
CHANGED
|
@@ -90,11 +90,14 @@ class VerificationPlugin extends _server().Plugin {
|
|
|
90
90
|
// values: {
|
|
91
91
|
// }
|
|
92
92
|
// });
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
try {
|
|
94
|
+
yield next();
|
|
95
|
+
} finally {
|
|
96
|
+
// or delete
|
|
97
|
+
yield item.update({
|
|
98
|
+
status: _constants.CODE_STATUS_USED
|
|
99
|
+
});
|
|
100
|
+
}
|
|
98
101
|
});
|
|
99
102
|
return function (_x, _x2) {
|
|
100
103
|
return _ref.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-verification",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"displayName": "verification",
|
|
4
|
+
"displayName.zh-CN": "验证码",
|
|
5
|
+
"description": "verification setting.",
|
|
6
|
+
"description.zh-CN": "验证码配置。",
|
|
7
|
+
"version": "0.10.0-alpha.2",
|
|
5
8
|
"license": "AGPL-3.0",
|
|
6
9
|
"main": "./lib/index.js",
|
|
7
10
|
"types": "./lib/index.d.ts",
|
|
@@ -9,14 +12,14 @@
|
|
|
9
12
|
"@alicloud/dysmsapi20170525": "2.0.17",
|
|
10
13
|
"@alicloud/openapi-client": "0.4.1",
|
|
11
14
|
"@alicloud/tea-util": "1.4.4",
|
|
12
|
-
"@nocobase/actions": "0.
|
|
13
|
-
"@nocobase/resourcer": "0.
|
|
14
|
-
"@nocobase/server": "0.
|
|
15
|
-
"@nocobase/utils": "0.
|
|
15
|
+
"@nocobase/actions": "0.10.0-alpha.2",
|
|
16
|
+
"@nocobase/resourcer": "0.10.0-alpha.2",
|
|
17
|
+
"@nocobase/server": "0.10.0-alpha.2",
|
|
18
|
+
"@nocobase/utils": "0.10.0-alpha.2",
|
|
16
19
|
"tencentcloud-sdk-nodejs": "^4.0.525"
|
|
17
20
|
},
|
|
18
21
|
"devDependencies": {
|
|
19
|
-
"@nocobase/test": "0.
|
|
22
|
+
"@nocobase/test": "0.10.0-alpha.2"
|
|
20
23
|
},
|
|
21
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "85028ae1733fcbd46ecd5d291dacbdc175f7f073"
|
|
22
25
|
}
|
|
@@ -5,17 +5,27 @@ import { observer, RecursionField, Schema, useField, useForm } from '@formily/re
|
|
|
5
5
|
|
|
6
6
|
import providerTypes from './providerTypes';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
8
|
+
const Verification = observer(
|
|
9
|
+
(props) => {
|
|
10
|
+
const form = useForm();
|
|
11
|
+
const field = useField<Field>();
|
|
12
|
+
const [s, setSchema] = useState(new Schema({}));
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
form.clearFormGraph('options.*');
|
|
15
|
+
setSchema(new Schema(providerTypes.get(form.values.type) || {}));
|
|
16
|
+
}, [form.values.type]);
|
|
17
|
+
return (
|
|
18
|
+
<FormLayout layout={'vertical'}>
|
|
19
|
+
<RecursionField
|
|
20
|
+
key={form.values.type || 'sms-aliyun'}
|
|
21
|
+
basePath={field.address}
|
|
22
|
+
onlyRenderProperties
|
|
23
|
+
schema={s}
|
|
24
|
+
/>
|
|
25
|
+
</FormLayout>
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
{ displayName: 'Verification' },
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export default Verification;
|
package/src/server/Plugin.ts
CHANGED
|
@@ -70,13 +70,14 @@ export default class VerificationPlugin extends Plugin {
|
|
|
70
70
|
|
|
71
71
|
// }
|
|
72
72
|
// });
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
try {
|
|
74
|
+
await next();
|
|
75
|
+
} finally {
|
|
76
|
+
// or delete
|
|
77
|
+
await item.update({
|
|
78
|
+
status: CODE_STATUS_USED,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
80
81
|
};
|
|
81
82
|
|
|
82
83
|
async install() {
|
package/lib/client/Shortcut.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Shortcut: () => JSX.Element;
|
package/lib/client/Shortcut.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Shortcut = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = _interopRequireDefault(require("react"));
|
|
9
|
-
_react = function _react() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _reactRouterDom() {
|
|
15
|
-
const data = require("react-router-dom");
|
|
16
|
-
_reactRouterDom = function _reactRouterDom() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _reactI18next() {
|
|
22
|
-
const data = require("react-i18next");
|
|
23
|
-
_reactI18next = function _reactI18next() {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
function _icons() {
|
|
29
|
-
const data = require("@ant-design/icons");
|
|
30
|
-
_icons = function _icons() {
|
|
31
|
-
return data;
|
|
32
|
-
};
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
function _client() {
|
|
36
|
-
const data = require("@nocobase/client");
|
|
37
|
-
_client = function _client() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
return data;
|
|
41
|
-
}
|
|
42
|
-
var _locale = require("./locale");
|
|
43
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
44
|
-
const Shortcut = () => {
|
|
45
|
-
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
46
|
-
t = _useTranslation.t;
|
|
47
|
-
const history = (0, _reactRouterDom().useHistory)();
|
|
48
|
-
return _react().default.createElement(_client().PluginManager.Toolbar.Item, {
|
|
49
|
-
icon: _react().default.createElement(_icons().CheckCircleOutlined, null),
|
|
50
|
-
title: t('Verification', {
|
|
51
|
-
ns: _locale.NAMESPACE
|
|
52
|
-
}),
|
|
53
|
-
onClick: () => {
|
|
54
|
-
history.push('/admin/settings/verification/providers');
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
exports.Shortcut = Shortcut;
|
package/src/client/Shortcut.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useHistory } from 'react-router-dom';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { CheckCircleOutlined } from '@ant-design/icons';
|
|
5
|
-
import { PluginManager } from '@nocobase/client';
|
|
6
|
-
import { NAMESPACE } from './locale';
|
|
7
|
-
|
|
8
|
-
export const Shortcut = () => {
|
|
9
|
-
const { t } = useTranslation();
|
|
10
|
-
const history = useHistory();
|
|
11
|
-
return (
|
|
12
|
-
<PluginManager.Toolbar.Item
|
|
13
|
-
icon={<CheckCircleOutlined />}
|
|
14
|
-
title={t('Verification', { ns: NAMESPACE })}
|
|
15
|
-
onClick={() => {
|
|
16
|
-
history.push('/admin/settings/verification/providers');
|
|
17
|
-
}}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
};
|