@nocobase/plugin-verification 2.1.0-beta.34 → 2.1.0-beta.36
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-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client-v2/190.d94e956a9694456c.js +10 -0
- package/dist/client-v2/290.f11db316dc0950b4.js +10 -0
- package/dist/client-v2/548.ecdd643db8c99582.js +10 -0
- package/dist/client-v2/81.e6bcc833e94bfccf.js +10 -0
- package/dist/client-v2/934.052004f5441bb578.js +10 -0
- package/dist/client-v2/973.a8f53a01fde3193f.js +10 -0
- package/dist/client-v2/components/VerificationCode.d.ts +49 -0
- package/dist/client-v2/components/VerifierSelect.d.ts +45 -0
- package/dist/client-v2/index.d.ts +19 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +99 -0
- package/dist/client-v2/otp-sms-provider-manager.d.ts +35 -0
- package/dist/client-v2/otp-verification/sms/AdminSettingsForm.d.ts +21 -0
- package/dist/client-v2/otp-verification/sms/BindForm.d.ts +18 -0
- package/dist/client-v2/otp-verification/sms/VerificationForm.d.ts +18 -0
- package/dist/client-v2/otp-verification/sms/index.d.ts +25 -0
- package/dist/client-v2/otp-verification/sms/providers/AliyunSettings.d.ts +17 -0
- package/dist/client-v2/otp-verification/sms/providers/TencentSettings.d.ts +17 -0
- package/dist/client-v2/pages/VerifiersPage.d.ts +61 -0
- package/dist/client-v2/plugin.d.ts +30 -0
- package/dist/client-v2/user-center/MyVerifiers.d.ts +19 -0
- package/dist/client-v2/user-center/VerificationUserCenterItemModel.d.ts +29 -0
- package/dist/client-v2/verification-manager.d.ts +49 -0
- package/dist/externalVersion.js +9 -6
- package/dist/node_modules/@alicloud/dysmsapi20170525/package.json +1 -1
- package/dist/node_modules/@alicloud/openapi-client/package.json +1 -1
- package/dist/node_modules/@alicloud/tea-util/package.json +1 -1
- package/dist/node_modules/tencentcloud-sdk-nodejs-sms/package.json +1 -1
- package/package.json +4 -2
package/client-v2.d.ts
ADDED
package/client-v2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client-v2/index.js');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_verification_client_v2=self.webpackChunk_nocobase_plugin_verification_client_v2||[]).push([["190"],{653:function(e,n,i){i.r(n),i.d(n,{VerificationForm:function(){return l}});var r=i(59),t=i(155),a=i.n(t),o=i(17),u=i(816);function l(e){var n=e.verifier,i=e.actionType,t=e.boundInfo,l=e.isLogged,c=(0,u.Au)().t,s=r.Form.useFormInstance(),m=r.Form.useWatch("uuid",s),d=!!(null==t?void 0:t.publicInfo);return a().createElement(a().Fragment,null,a().createElement(r.Form.Item,{name:"uuid",label:c("Phone"),rules:[{required:!0,message:c("Please enter a phone number")}],initialValue:null==t?void 0:t.publicInfo},a().createElement(r.Input,{disabled:d})),a().createElement(r.Form.Item,{name:"code",label:c("Verification code"),rules:[{required:!0,message:c("Please enter the verification code")}]},a().createElement(o.n,{actionType:i,verifier:n,phone:m,isLogged:l})))}n.default=l}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_verification_client_v2=self.webpackChunk_nocobase_plugin_verification_client_v2||[]).push([["290"],{289:function(e,t,n){n.r(t),n.d(t,{default:function(){return S},recursiveTrim:function(){return w},submitVerifierForm:function(){return E}});var r=n(375),i=n(485),o=n(694),a=n(625),u=n(59),l=n(773),c=n(155),s=n.n(c),f=n(816),m=n(373);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t,n,r,i,o,a){try{var u=e[o](a),l=u.value}catch(e){n(e);return}u.done?t(l):Promise.resolve(l).then(r,i)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){p(o,r,i,a,u,"next",e)}function u(e){p(o,r,i,a,u,"throw",e)}a(void 0)})}}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,u=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:l(0)}),u(a,"throw",{value:l(1)}),u(a,"return",{value:l(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function l(u){return function(l){var c=[u,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function w(e){return"string"==typeof e?e.trim():Array.isArray(e)?e.map(function(e){return w(e)}):e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"?Object.fromEntries(Object.entries(e).map(function(e){var t=h(e,2);return[t[0],w(t[1])]})):e}function E(e){return y(function(){var t,n,r;return g(this,function(i){switch(i.label){case 0:if(n=w(e.raw.options||{}),"create"!==e.mode)return[3,2];return[4,e.resource.create({values:v(b({},e.raw),{options:n})})];case 1:case 3:return i.sent(),e.onSubmitted(),[2];case 2:if((null==(t=e.record)?void 0:t.name)==null)return[3,4];return r=v(b({},(0,l.cloneDeep)(e.record),e.raw),{options:b({},e.record.options||{},n)}),[4,e.resource.update({filterByTk:e.record.name,values:r})];case 4:throw Error("Edit mode requires record.name; got ".concat(JSON.stringify(e.record)))}})})()}function O(){return(0,o.useFlowContext)().api.resource("verifiers")}function A(e){var t,n=(0,f.Au)().t,r=(0,f.kj)(),d=(0,i.useApp)().pm.get(m.A),p=O(),b=h(u.Form.useForm(),1)[0],v=h((0,c.useState)(!1),2),w=v[0],A=v[1],S=(0,c.useMemo)(function(){return e.verificationTypeOptions.map(function(e){return{value:e.name,label:r(e.title||e.name)}})},[e.verificationTypeOptions,r]),T=(0,c.useMemo)(function(){return"edit"===e.mode?(0,l.cloneDeep)(e.record||{}):{name:(0,o.randomId)("v_"),verificationType:e.verificationType,options:{}}},[e.mode,e.record,e.verificationType]);(0,c.useEffect)(function(){b.setFieldsValue(T)},[b,T]);var j=(0,c.useMemo)(function(){var t,n,r=null==d||null==(n=d.verificationManager.getVerification(e.verificationType))||null==(t=n.components)?void 0:t.AdminSettingsFormLoader;return r?(0,c.lazy)(r):null},[d,e.verificationType]),k=(0,a.useMemoizedFn)(function(){return y(function(){var t;return g(this,function(n){switch(n.label){case 0:return[4,b.validateFields()];case 1:t=n.sent(),A(!0),n.label=2;case 2:return n.trys.push([2,,4,5]),[4,E({raw:t,mode:e.mode,record:e.record,resource:p,onSubmitted:e.onSubmitted})];case 3:return n.sent(),[3,5];case 4:return A(!1),[7];case 5:return[2]}})})()});return s().createElement(i.DrawerFormLayout,{title:n("create"===e.mode?"Add new":"Edit"),onSubmit:k,submitting:w,submitText:n("Submit"),cancelText:n("Cancel")},s().createElement(u.Form,{form:b,layout:"vertical",initialValues:T},s().createElement(u.Form.Item,{name:"name",label:n("UID"),rules:[{required:!0,message:n("Please enter a UID")},{pattern:/^[a-zA-Z0-9_-]+$/,message:n("a-z, A-Z, 0-9, _, -")}]},s().createElement(u.Input,{disabled:"edit"===e.mode})),s().createElement(u.Form.Item,{name:"title",label:n("Title")},s().createElement(u.Input,null)),s().createElement(u.Form.Item,{name:"description",label:n("Description")},s().createElement(u.Input.TextArea,null)),s().createElement(u.Form.Item,{name:"verificationType",hidden:!0},s().createElement(u.Input,null)),"edit"===e.mode?s().createElement(u.Form.Item,{label:n("Verification type")},s().createElement(u.Tag,null,null==(t=S.find(function(t){return t.value===e.verificationType}))?void 0:t.label)):null,j?s().createElement(c.Suspense,{fallback:null},s().createElement(j,null)):null))}function S(){var e,t=(0,f.Au)().t,n=(0,f.kj)(),l=(0,o.useFlowContext)(),m=u.theme.useToken().token,d=u.App.useApp().modal,p=O(),b=h((0,c.useState)(1),2),v=b[0],w=b[1],E=h((0,c.useState)([]),2),S=E[0],T=E[1],j=(e=O(),(0,a.useRequest)(function(){return y(function(){var t,n,r;return g(this,function(i){switch(i.label){case 0:return[4,e.listTypes()];case 1:return[2,Array.isArray(r=Array.isArray(n=null==(t=i.sent())?void 0:t.data)?n:null==n?void 0:n.data)?r:[]]}})})()},{cacheKey:"@nocobase/plugin-verification:verifiers:listTypes"})).data,k=(0,c.useMemo)(function(){return j||[]},[j]),I=(0,a.useRequest)(function(){return y(function(){return g(this,function(e){switch(e.label){case 0:return[4,p.list({page:v,pageSize:50,appends:[]})];case 1:var t,n,r,i,o,a,u,l;return[2,(a=Array.isArray(o=null==(i=null==(t=e.sent())?void 0:t.data)?void 0:i.data)?o:Array.isArray(null==o?void 0:o.data)?o.data:[],u=Array.isArray(o)||null==o?void 0:o.meta,{records:a,total:null!=(n=null!=(r=(l=(null==i?void 0:i.meta)||u||{}).count)?r:l.total)?n:a.length})]}})})()},{refreshDeps:[v]}),D=I.data,F=I.loading,x=I.refresh,P=(0,a.useMemoizedFn)(function(e,t,n){l.viewer.drawer({width:"50%",closable:!0,content:function(){return s().createElement(A,{mode:e,verificationType:t,verificationTypeOptions:k,record:n,onSubmitted:function(){return x()}})}})}),C=(0,a.useMemoizedFn)(function(e){d.confirm({title:t("Delete"),content:t("Are you sure you want to delete it?"),onOk:function(){return y(function(){return g(this,function(t){switch(t.label){case 0:return[4,p.destroy({filterByTk:e})];case 1:return t.sent(),T([]),x(),[2]}})})()}})}),_=(0,a.useMemoizedFn)(function(e){var t=k.find(function(t){return t.name===e});return n((null==t?void 0:t.title)||e||"")}),M=(0,c.useMemo)(function(){return[{title:t("UID"),dataIndex:"name"},{title:t("Title"),dataIndex:"title"},{title:t("Verification type"),dataIndex:"verificationType",render:function(e){return e?s().createElement(u.Tag,null,_(e)):null}},{title:t("Description"),dataIndex:"description"},{title:t("Actions"),width:160,render:function(e,n){return s().createElement(u.Space,null,s().createElement("a",{onClick:function(){n.verificationType&&P("edit",n.verificationType,n)}},t("Edit")),s().createElement("a",{onClick:function(){return null!=n.name&&C(n.name)}},t("Delete")))}}]},[C,P,t,_]);return s().createElement(u.Card,{variant:"borderless"},s().createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:m.marginSM,marginBottom:m.margin}},s().createElement(u.Button,{icon:s().createElement(r.DeleteOutlined,null),disabled:!S.length,onClick:function(){return C(S)}},t("Delete")),s().createElement(u.Dropdown,{menu:{items:k.map(function(e){return{key:e.name,label:n(e.title||e.name)}}),onClick:function(e){P("create",e.key)}},disabled:!k.length},s().createElement(u.Button,{type:"primary",icon:s().createElement(r.PlusOutlined,null)},t("Add new")," ",s().createElement(r.DownOutlined,null)))),s().createElement(i.Table,{rowKey:"name",loading:F,columns:M,dataSource:(null==D?void 0:D.records)||[],rowSelection:{selectedRowKeys:S,onChange:T},pagination:{current:v,pageSize:50,total:(null==D?void 0:D.total)||0,showSizeChanger:!1,onChange:w}}))}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_verification_client_v2=self.webpackChunk_nocobase_plugin_verification_client_v2||[]).push([["548"],{239:function(e,t,n){n.r(t),n.d(t,{TencentSettings:function(){return m}});var a=n(485),l=n(59),r=n(155),s=n.n(r),i=n(816);function m(){var e=(0,i.Au)().t;return s().createElement(s().Fragment,null,s().createElement(l.Form.Item,{name:["options","settings","secretId"],label:e("Secret Id"),rules:[{required:!0,message:e("Please enter the Secret Id")}]},s().createElement(a.EnvVariableInput,null)),s().createElement(l.Form.Item,{name:["options","settings","secretKey"],label:e("Secret Key"),rules:[{required:!0,message:e("Please enter the Secret Key")}]},s().createElement(a.EnvVariableInput,{password:!0})),s().createElement(l.Form.Item,{name:["options","settings","region"],label:e("Region"),rules:[{required:!0,message:e("Please enter the region")}]},s().createElement(a.EnvVariableInput,null)),s().createElement(l.Form.Item,{name:["options","settings","endpoint"],label:e("Endpoint"),initialValue:"sms.tencentcloudapi.com"},s().createElement(a.EnvVariableInput,null)),s().createElement(l.Form.Item,{name:["options","settings","SignName"],label:e("Sign name")},s().createElement(a.EnvVariableInput,null)),s().createElement(l.Form.Item,{name:["options","settings","SmsSdkAppId"],label:e("Sms sdk app id"),rules:[{required:!0,message:e("Please enter the Sms sdk app id")}]},s().createElement(a.EnvVariableInput,null)),s().createElement(l.Form.Item,{name:["options","settings","TemplateId"],label:e("Template Id"),rules:[{required:!0,message:e("Please enter the Template Id")}]},s().createElement(a.EnvVariableInput,null)))}t.default=m}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_verification_client_v2=self.webpackChunk_nocobase_plugin_verification_client_v2||[]).push([["81"],{560:function(e,r,t){t.r(r),t.d(r,{AdminSettingsForm:function(){return f}});var n=t(485),o=t(694),a=t(59),l=t(155),u=t.n(l),i=t(816),c=t(373);function s(e,r,t,n,o,a,l){try{var u=e[a](l),i=u.value}catch(e){t(e);return}u.done?r(i):Promise.resolve(i).then(n,o)}function f(){var e=(0,i.Au)().t,r=(0,i.kj)(),t=(0,o.useFlowContext)(),f=(0,n.useApp)().pm.get(c.A),p=a.Form.useFormInstance(),v=a.Form.useWatch(["options","provider"],p),m=(0,l.useMemo)(function(){if(!v)return null;var e,r,t=null==f||null==(r=f.smsOTPProviderManager.getProvider(v))||null==(e=r.components)?void 0:e.AdminSettingsFormLoader;return t?(0,l.lazy)(t):null},[f,v]);return u().createElement(u().Fragment,null,u().createElement(a.Form.Item,{name:["options","provider"],label:e("Provider"),rules:[{required:!0,message:e("Please select a provider")}]},u().createElement(n.RemoteSelect,{request:function(){var e;return(e=function(){var e,r,n;return function(e,r){var t,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:i(0)}),u(l,"throw",{value:i(1)}),u(l,"return",{value:i(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function i(u){return function(i){var c=[u,i];if(t)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(t=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=r.call(e,a)}catch(e){c=[6,e],n=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:return[4,t.api.resource("smsOTPProviders").list()];case 1:return[2,Array.isArray(n=null==(r=o.sent())||null==(e=r.data)?void 0:e.data)?n:[]]}})},function(){var r=this,t=arguments;return new Promise(function(n,o){var a=e.apply(r,t);function l(e){s(a,n,o,l,u,"next",e)}function u(e){s(a,n,o,l,u,"throw",e)}l(void 0)})})()},cacheKey:"@nocobase/plugin-verification:smsOTPProviders:list",mapOptions:function(e){return{label:r(e.title||e.name),value:e.name}}})),m?u().createElement(l.Suspense,{fallback:null},u().createElement(m,null)):null)}r.default=f}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_verification_client_v2=self.webpackChunk_nocobase_plugin_verification_client_v2||[]).push([["934"],{397:function(e,n,r){r.r(n),r.d(n,{BindForm:function(){return c}});var t=r(59),i=r(155),a=r.n(i),o=r(17),u=r(816);function c(e){var n=e.verifier,r=e.actionType,i=e.isLogged,c=(0,u.Au)().t,l=t.Form.useFormInstance(),s=t.Form.useWatch("uuid",l);return a().createElement(a().Fragment,null,a().createElement(t.Form.Item,{name:"uuid",label:c("Phone"),rules:[{required:!0,message:c("Please enter a phone number")}]},a().createElement(t.Input,null)),a().createElement(t.Form.Item,{name:"code",label:c("Verification code"),rules:[{required:!0,message:c("Please enter the verification code")}]},a().createElement(o.n,{actionType:r,verifier:n,phone:s,isLogged:i})))}n.default=c}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_verification_client_v2=self.webpackChunk_nocobase_plugin_verification_client_v2||[]).push([["973"],{708:function(e,t,n){n.r(t),n.d(t,{AliyunSettings:function(){return c}});var s=n(485),a=n(59),l=n(155),r=n.n(l),i=n(816);function c(){var e=(0,i.Au)().t;return r().createElement(r().Fragment,null,r().createElement(a.Form.Item,{name:["options","settings","accessKeyId"],label:e("Access Key ID"),rules:[{required:!0,message:e("Please enter the Access Key ID")}]},r().createElement(s.EnvVariableInput,null)),r().createElement(a.Form.Item,{name:["options","settings","accessKeySecret"],label:e("Access Key Secret"),rules:[{required:!0,message:e("Please enter the Access Key Secret")}]},r().createElement(s.EnvVariableInput,{password:!0})),r().createElement(a.Form.Item,{name:["options","settings","endpoint"],label:e("Endpoint"),rules:[{required:!0,message:e("Please enter the endpoint")}]},r().createElement(s.EnvVariableInput,null)),r().createElement(a.Form.Item,{name:["options","settings","sign"],label:e("Sign"),rules:[{required:!0,message:e("Please enter the sign")}]},r().createElement(s.EnvVariableInput,null)),r().createElement(a.Form.Item,{name:["options","settings","template"],label:e("Template code"),rules:[{required:!0,message:e("Please enter the template code")}]},r().createElement(s.EnvVariableInput,null)))}t.default=c}}]);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export interface VerificationCodeProps {
|
|
11
|
+
/** Persisted OTP value. Controlled by the parent `Form.Item`. */
|
|
12
|
+
value?: string;
|
|
13
|
+
onChange?: (next: string) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Server-side action the OTP grants (e.g. `auth:signIn`,
|
|
16
|
+
* `verifiers:bind`, `twoFactorAuth:verify`). Forwarded to the
|
|
17
|
+
* `smsOTP:*` endpoint so the OTP is bound to a specific action.
|
|
18
|
+
*/
|
|
19
|
+
actionType: string;
|
|
20
|
+
/** Verifier name (a row in the `verifiers` collection). */
|
|
21
|
+
verifier: string;
|
|
22
|
+
/**
|
|
23
|
+
* The phone number the OTP is sent to. Parent reads it via
|
|
24
|
+
* `Form.useWatch('uuid', form)` and forwards it here. Required at send
|
|
25
|
+
* time — the send button is disabled until it has a value.
|
|
26
|
+
*/
|
|
27
|
+
phone?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the user is already signed in. Drives the choice between
|
|
30
|
+
* `smsOTP:create` (logged-in) and `smsOTP:publicCreate` (anonymous).
|
|
31
|
+
* Defaults to `false` (anonymous).
|
|
32
|
+
*/
|
|
33
|
+
isLogged?: boolean;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Verification-code input + "Send code / Retry in N s" button pair.
|
|
39
|
+
*
|
|
40
|
+
* Rewrite of v1's `VerificationCode`:
|
|
41
|
+
* - No `withDynamicSchemaProps`, no `useForm()` — the parent owns the
|
|
42
|
+
* phone value via `Form.useWatch` and passes it in as a prop.
|
|
43
|
+
* - Countdown starts from the server-reported `expiresAt` so the UI
|
|
44
|
+
* tracks the same window the server enforces.
|
|
45
|
+
* - Clearing the code on resend matches v1 behaviour so the user has
|
|
46
|
+
* to type the new code rather than reusing the stale one.
|
|
47
|
+
*/
|
|
48
|
+
export declare function VerificationCode(props: VerificationCodeProps): React.JSX.Element;
|
|
49
|
+
export default VerificationCode;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export interface VerifierSelectProps {
|
|
11
|
+
/**
|
|
12
|
+
* Verification scene name passed to `verifiers:listByScene`. Each
|
|
13
|
+
* consumer plugin uses its own scene (e.g. `auth-sms`, `two-factor`,
|
|
14
|
+
* `unbind-verifier`) so different scenes can opt different verifier
|
|
15
|
+
* types in or out via server config.
|
|
16
|
+
*/
|
|
17
|
+
scene: string;
|
|
18
|
+
value?: string | string[];
|
|
19
|
+
onChange?: (next: string | string[]) => void;
|
|
20
|
+
/** Default false. */
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* antd `Select` style passthrough. Keep this open in case a caller
|
|
26
|
+
* needs to size the dropdown explicitly inside a constrained form.
|
|
27
|
+
*/
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
/**
|
|
30
|
+
* Suppress the helper text rendered under the Select. Defaults to
|
|
31
|
+
* `false`; pass `true` when the caller wants to host its own hint
|
|
32
|
+
* (e.g. inside a `Form.Item.extra` slot).
|
|
33
|
+
*/
|
|
34
|
+
hideHint?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Domain wrapper around the framework-level `RemoteSelect`. Loads the
|
|
38
|
+
* verifiers configured for `scene` from `/verifiers:listByScene` and
|
|
39
|
+
* binds them to a single- or multi-select. The helper text underneath
|
|
40
|
+
* mirrors the v1 affordance: a list of available verifier types and a
|
|
41
|
+
* deep link into the admin settings page. The list of available types
|
|
42
|
+
* comes from the same response, so no extra request is needed.
|
|
43
|
+
*/
|
|
44
|
+
export declare function VerifierSelect(props: VerifierSelectProps): React.JSX.Element;
|
|
45
|
+
export default VerifierSelect;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { PROVIDER_TYPE_SMS_ALIYUN, PROVIDER_TYPE_SMS_TENCENT, SMS_OTP_VERIFICATION_TYPE } from '../constants';
|
|
10
|
+
export { default, PluginVerificationClientV2 } from './plugin';
|
|
11
|
+
export { NAMESPACE, useT, useVerificationTranslation } from './locale';
|
|
12
|
+
export { VerificationManager } from './verification-manager';
|
|
13
|
+
export type { BindFormProps, VerificationFormProps, VerificationTypeOptions } from './verification-manager';
|
|
14
|
+
export { SMSOTPProviderManager } from './otp-sms-provider-manager';
|
|
15
|
+
export type { SMSOTPProviderOptions } from './otp-sms-provider-manager';
|
|
16
|
+
export { VerifierSelect } from './components/VerifierSelect';
|
|
17
|
+
export type { VerifierSelectProps } from './components/VerifierSelect';
|
|
18
|
+
export { VerificationCode } from './components/VerificationCode';
|
|
19
|
+
export type { VerificationCodeProps } from './components/VerificationCode';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("react-i18next"),require("@nocobase/client-v2"),require("react-router-dom"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-verification/client-v2",["ahooks","react-i18next","@nocobase/client-v2","react-router-dom","react","antd","@ant-design/icons","@nocobase/flow-engine","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-verification/client-v2"]=t(require("ahooks"),require("react-i18next"),require("@nocobase/client-v2"),require("react-router-dom"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-verification/client-v2"]=t(e.ahooks,e["react-i18next"],e["@nocobase/client-v2"],e["react-router-dom"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,i,o,a,u,c,l){return function(){"use strict";var s,f,p,d={17:function(e,t,n){n.d(t,{n:function(){return f}});var r=n(694),i=n(625),o=n(59),a=n(155),u=n.n(a),c=n(816);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,i)}function f(e){var t,n=e.value,f=e.onChange,p=e.actionType,d=e.verifier,v=e.phone,b=e.isLogged,y=e.disabled,m=e.placeholder,h=(0,c.Au)().t,g=(0,r.useFlowContext)(),w=o.App.useApp(),S=w.message,O=w.notification,T=function(e){if(Array.isArray(e))return e}(t=(0,a.useState)(0))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],o=!0,a=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(i.push(t.value),2!==i.length);o=!0);}catch(e){a=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(a)throw n}}return i}}(t)||function(e){if(e){if("string"==typeof e)return l(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),P=T[0],E=T[1],k=(0,a.useRef)(null);(0,a.useEffect)(function(){P<=0&&k.current&&(clearInterval(k.current),k.current=null)},[P]),(0,a.useEffect)(function(){return function(){k.current&&(clearInterval(k.current),k.current=null)}},[]);var j=(0,i.useMemoizedFn)(function(){var e;return(e=function(){var e,t,r,i,o,a,u,c,l,s;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(y){switch(y.label){case 0:if(P>0)return[2];if(!v)return S.error(h("Please enter a phone number first")),[2];e=b?"create":"publicCreate",y.label=1;case 1:return y.trys.push([1,3,,4]),[4,g.api.resource("smsOTP")[e]({values:{action:p,verifier:d,uuid:v}})];case 2:return i=(null==(r=y.sent())||null==(t=r.data)?void 0:t.data)||{},S.success(h("Operation succeeded")),n&&(null==f||f("")),E(i.expiresAt?Math.max(1,Math.ceil((Date.parse(i.expiresAt)-Date.now())/1e3)):60),k.current=setInterval(function(){E(function(e){return e-1})},1e3),[3,4];case 3:return s=(null==(o=y.sent())||null==(l=o.response)||null==(c=l.data)||null==(u=c.errors)||null==(a=u[0])?void 0:a.message)||(null==o?void 0:o.message),O.error({message:s||h("Verification send failed, please try later or contact to administrator")}),[3,4];case 4:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,u,"next",e)}function u(e){s(o,r,i,a,u,"throw",e)}a(void 0)})})()});return u().createElement(o.Space.Compact,{style:{width:"100%"}},u().createElement(o.Input,{value:n,onChange:function(e){return null==f?void 0:f(e.target.value)},disabled:y,placeholder:m}),u().createElement(o.Button,{onClick:j,disabled:y||P>0},P>0?h("Retry after {{count}} seconds",{count:P}):h("Send code")))}},373:function(e,t,n){n.d(t,{A:function(){return z},I:function(){return G}});var r=n(485),i=n(624),o=n(816),a={components:{VerificationFormLoader:function(){return n.e("190").then(n.bind(n,653))},AdminSettingsFormLoader:function(){return n.e("81").then(n.bind(n,560))},BindFormLoader:function(){return n.e("934").then(n.bind(n,397))}}},u={components:{AdminSettingsFormLoader:function(){return n.e("973").then(n.bind(n,708))}}},c={components:{AdminSettingsFormLoader:function(){return n.e("548").then(n.bind(n,239))}}},l=n(261),s=n(155),f=n.n(s),p=n(694),d=n(625),v=n(59);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,i)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){y(o,r,i,a,u,"next",e)}function u(e){y(o,r,i,a,u,"throw",e)}a(void 0)})}}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,u=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function S(){var e=new Map;return function(t,n){var r=e.get(t);if(r)return r;var i=(0,s.lazy)(n);return e.set(t,i),i}}var O=S();function T(e){var t,n,i=(0,o.Au)().t,a=(0,o.kj)(),u=(0,p.useFlowContext)(),c=(0,r.useApp)().pm.get(z),l=null==c||null==(n=c.verificationManager.getVerification(e.verifier.verificationType))||null==(t=n.components)?void 0:t.BindFormLoader,b=(0,s.useMemo)(function(){return l?O(e.verifier.verificationType,l):null},[l,e.verifier.verificationType]),y=g(v.Form.useForm(),1)[0],S=g((0,s.useState)(!1),2),T=S[0],P=S[1],E=a(e.verifier.title||"")||i("Bind"),k=(0,d.useMemoizedFn)(function(){return m(function(){var t;return w(this,function(n){switch(n.label){case 0:return[4,y.validateFields()];case 1:t=n.sent(),P(!0),n.label=2;case 2:return n.trys.push([2,,4,5]),[4,u.api.resource("verifiers").bind({values:h({verifier:e.verifier.name},t)})];case 3:return n.sent(),e.onSubmitted(),[3,5];case 4:return P(!1),[7];case 5:return[2]}})})()});return b?f().createElement(r.DialogFormLayout,{title:E,onSubmit:k,submitting:T,submitText:i("Bind"),cancelText:i("Cancel")},f().createElement(v.Form,{form:y,layout:"vertical"},f().createElement(s.Suspense,{fallback:f().createElement(v.Spin,null)},f().createElement(b,{verifier:e.verifier.name,actionType:"verifiers:bind",isLogged:!0})))):f().createElement(r.DialogFormLayout,{title:E,onSubmit:function(){return m(function(){return w(this,function(e){return[2,void 0]})})()},submitText:i("Close"),cancelText:i("Cancel")},f().createElement(v.Alert,{type:"warning",showIcon:!0,message:i("This verifier type ({{type}}) is not yet supported in the new client. Please switch to the legacy client to bind it.",{type:e.verifier.verificationType})}))}var P=S();function E(e){var t,n=(0,o.kj)(),i=(0,o.Au)().t,a=(0,p.useFlowContext)(),u=(0,r.useApp)().pm.get(z),c=null==(t=e.availableVerifiers[0])?void 0:t.name,l=g((0,s.useState)(c),2),b=l[0],y=l[1],S=g(v.Form.useForm(),1)[0],O=g((0,s.useState)(!1),2),T=O[0],E=O[1],k=(0,d.useMemoizedFn)(function(){return m(function(){var t;return w(this,function(n){switch(n.label){case 0:if(!b)return[2];return[4,S.validateFields()];case 1:t=n.sent(),E(!0),n.label=2;case 2:return n.trys.push([2,,4,5]),[4,a.api.resource("verifiers").unbind({values:h({verifier:b,unbindVerifier:e.targetVerifier.name},t)})];case 3:return n.sent(),e.onSubmitted(),[3,5];case 4:return E(!1),[7];case 5:return[2]}})})()}),j=e.availableVerifiers.map(function(e){var t,r,i=null==u||null==(r=u.verificationManager.getVerification(e.verificationType))||null==(t=r.components)?void 0:t.VerificationFormLoader;if(!i)return null;var o=P(e.verificationType,i),a=n(e.title||"")||n(e.verificationTypeTitle||e.verificationType);return{key:e.name,label:a,children:f().createElement(s.Suspense,{fallback:f().createElement(v.Spin,null)},f().createElement(o,{verifier:e.name,actionType:"verifiers:unbind",boundInfo:e.boundInfo,isLogged:!0}))}}).filter(Boolean);return f().createElement(r.DialogFormLayout,{title:i("Unbind verifier"),onSubmit:k,submitting:T,submitText:i("Unbind"),cancelText:i("Cancel")},f().createElement(v.Form,{form:S,layout:"vertical"},j.length?f().createElement(v.Tabs,{activeKey:b,onChange:function(e){S.resetFields(),y(e)},destroyInactiveTabPane:!0,items:j}):f().createElement("span",null,i("No verifier available to verify your identity."))))}function k(e){var t,n=(0,o.Au)().t,r=(0,p.useFlowContext)(),i=!!(null==(t=e.verifier.boundInfo)?void 0:t.bound),a=(0,d.useMemoizedFn)(function(){r.viewer.dialog({closable:!0,content:function(){return f().createElement(T,{verifier:e.verifier,onSubmitted:function(){return e.onChanged()}})}})}),u=(0,d.useMemoizedFn)(function(){return m(function(){var t,n,i;return w(this,function(o){switch(o.label){case 0:return[4,r.api.resource("verifiers").listForVerify({scene:"unbind-verifier"})];case 1:return i=(null==(n=o.sent())||null==(t=n.data)?void 0:t.data)||[],r.viewer.dialog({closable:!0,content:function(){return f().createElement(E,{targetVerifier:e.verifier,availableVerifiers:i,onSubmitted:function(){return e.onChanged()}})}}),[2]}})})()});return i?f().createElement("a",{onClick:u},n("Unbind")):f().createElement("a",{onClick:a},n("Bind"))}function j(){var e=(0,o.kj)(),t=(0,o.Au)().t,n=(0,p.useFlowContext)(),r=v.App.useApp().message,i=(0,d.useRequest)(function(){return m(function(){var e,t;return w(this,function(r){switch(r.label){case 0:return[4,n.api.resource("verifiers").listByUser()];case 1:return[2,(null==(t=r.sent())||null==(e=t.data)?void 0:e.data)||[]]}})})()}),a=i.data,u=i.loading,c=i.refresh,l=(0,d.useMemoizedFn)(function(){c(),r.success(t("Operation succeeded"))});return u?f().createElement(v.Spin,null):f().createElement(v.List,{bordered:!0,dataSource:a||[],renderItem:function(n){var r,i;return f().createElement(v.List.Item,{actions:[f().createElement(k,{key:"action",verifier:n,onChanged:l})]},f().createElement(v.List.Item.Meta,{title:f().createElement(f().Fragment,null,e(n.title||"")," ",(null==(r=n.boundInfo)?void 0:r.bound)?f().createElement(v.Tag,{color:"success"},t("Configured")):f().createElement(v.Tag,{color:"warning"},t("Not configured"))),description:e(n.description||"")}),f().createElement("div",null,null==(i=n.boundInfo)?void 0:i.publicInfo))}})}function x(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,i)}function A(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}var _=[o.CU,"client"],V=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=I(t),A(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,M()?Reflect.construct(t,r||[],I(this).constructor):t.apply(this,r)),"section","profile"),A(e,"sort",150),A(e,"label","Verification"),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&C(n,e),t=[{key:"getLabelNode",value:function(){return this.context.t("Verification",{ns:_,nsMode:"fallback"})}},{key:"onClick",value:function(){var e;return(e=function(){return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.context.viewer.drawer({title:this.context.t("Verification",{ns:_,nsMode:"fallback"}),width:"50%",closable:!0,content:function(){return f().createElement(j,null)}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){x(o,r,i,a,u,"next",e)}function u(e){x(o,r,i,a,u,"throw",e)}a(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(r.UserCenterActionItemModel);A(V,"itemId","verification");var F=n(319);function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function U(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,i)}function R(e,t,n){return(R=K()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&N(i,n.prototype),i}).apply(null,arguments)}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(e){var t="function"==typeof Map?new Map:void 0;return(D=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return R(e,arguments,B(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),N(n,e)})(e)}function K(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(K=function(){return!!e})()}var G=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=B(t),L(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,K()?Reflect.construct(t,n||[],B(this).constructor):t.apply(this,n)),"verificationManager",new F.X),L(e,"smsOTPProviderManager",new l.X),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&N(r,e),t=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return e=this,Object.entries(o.DR).forEach(function(t){var n=function(e){if(Array.isArray(e))return e}(t)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],o=!0,a=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(i.push(t.value),2!==i.length);o=!0);}catch(e){a=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(a)throw n}}return i}}(t)||function(e){if(e){if("string"==typeof e)return q(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return q(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),r=n[0],i=n[1];e.app.i18n.addResources(r,o.CU,i)}),this.app.flowEngine.registerModels({VerificationUserCenterItemModel:V}),this.registerSettingsPages(),this.verificationManager.registerVerificationType(i.Fz,a),this.smsOTPProviderManager.registerProvider(i.ob,u),this.smsOTPProviderManager.registerProvider(i.Zs,c),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){U(o,r,i,a,u,"next",e)}function u(e){U(o,r,i,a,u,"throw",e)}a(void 0)})}).call(this)}},{key:"registerSettingsPages",value:function(){var e=this,t=function(t){return e.app.i18n.t(t,{ns:o.CU})};this.pluginSettingsManager.addMenuItem({key:o.CU,title:t("Verification"),icon:"CheckCircleOutlined",aclSnippet:"pm.verification"}),this.pluginSettingsManager.addPageTabItem({menuKey:o.CU,key:"index",title:t("Verifiers"),icon:"CheckCircleOutlined",aclSnippet:"pm.verification.verifiers",sort:1,componentLoader:function(){return n.e("290").then(n.bind(n,289))}})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(D(r.Plugin)),z=G},816:function(e,t,n){n.d(t,{DR:function(){return c},kj:function(){return s},CU:function(){return u},Au:function(){return l}});var r=n(694),i=n(953),o=JSON.parse('{"Access Key ID":"Access Key ID","Access Key Secret":"Access Key Secret","Aliyun SMS":"Aliyun SMS","Bind":"Bind","Bound successfully":"Bound successfully","Configured":"Configured","Endpoint":"Endpoint","Get one-time codes sent to your phone via SMS to complete authentication requests.":"Get one-time codes sent to your phone via SMS to complete authentication requests.","Go to":"Go to","Not a valid cellphone number, please re-enter":"Not a valid cellphone number, please re-enter","Not configured":"Not configured","Please don\'t retry in {{time}} seconds":"Please don\'t retry in {{time}} seconds","Provider":"Provider","Provider type":"Provider type","Region":"Region","SMS OTP":"SMS OTP","Secret Id":"Secret Id","Secret Key":"Secret Key","Sign":"Sign","Sign name":"Sign name","Sms sdk app id":"Sms sdk app id","Template Id":"Template Id","Template code":"Template code","Tencent SMS":"Tencent SMS","The following types of verifiers are available:":"The following types of verifiers are available: ","Too many failed attempts. Please request a new verification code.":"Too many failed attempts. Please request a new verification code.","Unbind":"Unbind","Unbind verifier":"Unbind verifier","Unbound successfully":"Unbound successfully","Verification":"Verification","Verification code is invalid":"Verification code is invalid","Verification providers":"Verification providers","Verification send failed, please try later or contact to administrator":"Verification send failed, please try later or contact to administrator","Verification type":"Verification type","Verifier":"Verifier","Verifiers":"Verifiers","You are trying so frequently, please slow down":"You are trying so frequently, please slow down","create verifiers":"create verifiers"}'),a=JSON.parse('{"Access Key ID":"Access Key ID","Access Key Secret":"Access Key Secret","Aliyun SMS":"阿里云短信服务","Bind":"绑定","Bound successfully":"绑定成功","Configured":"已配置","Endpoint":"接入点","Get one-time codes sent to your phone via SMS to complete authentication requests.":"获取一次性短信验证码,以完成身份验证请求。","Go to":"前往","Not a valid cellphone number, please re-enter":"不是有效的手机号,请重新输入","Not configured":"未配置","Please don\'t retry in {{time}} seconds":"请 {{time}} 秒后再试","Provider":"服务商","Provider type":"提供商类型","Region":"地域","SMS OTP":"短信验证码","Secret Id":"Secret Id","Secret Key":"Secret Key","Sign":"签名","Sign name":"短信签名内容","Sms sdk app id":"短信应用 ID","Template Id":"短信模板 ID","Template code":"模板代码","Tencent SMS":"腾讯云短信服务","The following types of verifiers are available:":"以下类型的验证器可选:","Too many failed attempts. Please request a new verification code.":"验证失败次数过多,请重新获取验证码。","Unbind":"解绑","Unbind verifier":"解绑验证器","Unbound successfully":"解绑成功","Verification":"验证码","Verification code is invalid":"无效的验证码","Verification providers":"验证码提供商","Verification send failed, please try later or contact to administrator":"验证码发送失败,请稍后重试或联系管理员","Verification type":"验证类型","Verifier":"验证器","Verifiers":"验证器","You are trying so frequently, please slow down":"您的操作太频繁,请稍后再试","create verifiers":"创建验证器"}'),u="verification",c={"en-US":o,"zh-CN":a};function l(){return(0,i.useTranslation)([u,"client"],{nsMode:"fallback"})}function s(){var e=(0,r.useFlowEngine)();return function(t){return e.context.t(t,{ns:[u,"client"],nsMode:"fallback"})}}},261:function(e,t,n){n.d(t,{X:function(){return i}});var r=n(768),i=function(){var e;function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");e="providers",n=new r.Registry,e in this?Object.defineProperty(this,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):this[e]=n}return e=[{key:"registerProvider",value:function(e,t){this.providers.register(e,t)}},{key:"getProvider",value:function(e){return this.providers.get(e)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}()},319:function(e,t,n){n.d(t,{X:function(){return i}});var r=n(768),i=function(){var e;function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");e="verifications",n=new r.Registry,e in this?Object.defineProperty(this,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):this[e]=n}return e=[{key:"registerVerificationType",value:function(e,t){this.verifications.register(e,t)}},{key:"getVerification",value:function(e){return this.verifications.get(e)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}()},624:function(e,t,n){n.d(t,{Fz:function(){return r},Zs:function(){return o},ob:function(){return i}});var r="sms-otp",i="sms-aliyun",o="sms-tencent"},375:function(e){e.exports=a},485:function(e){e.exports=n},694:function(e){e.exports=u},768:function(e){e.exports=c},625:function(t){t.exports=e},59:function(e){e.exports=o},773:function(e){e.exports=l},155:function(e){e.exports=i},953:function(e){e.exports=t},442:function(e){e.exports=r}},v={};function b(e){var t=v[e];if(void 0!==t)return t.exports;var n=v[e]={exports:{}};return d[e](n,n.exports,b),n.exports}b.m=d,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+e+"."+({190:"d94e956a9694456c",290:"f11db316dc0950b4",548:"ecdd643db8c99582",81:"e6bcc833e94bfccf",934:"052004f5441bb578",973:"a8f53a01fde3193f"})[e]+".js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},b.l=function(e,t,n,r){if(y[e])return void y[e].push(t);if(void 0!==n)for(var i,o,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var c=a[u];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-verification/client-v2:"+n){i=c;break}}i||(o=!0,(i=document.createElement("script")).timeout=120,b.nc&&i.setAttribute("nonce",b.nc),i.setAttribute("data-rspack","@nocobase/plugin-verification/client-v2:"+n),i.src=e),y[e]=[t];var l=function(t,n){i.onerror=i.onload=null,clearTimeout(s);var r=y[e];if(delete y[e],i.parentNode&&i.parentNode.removeChild(i),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),o&&document.head.appendChild(i)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(m=b.g.location+"");var y,m,h=b.g.document;if(!m&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(m=h.currentScript.src),!m)){var g=h.getElementsByTagName("script");if(g.length)for(var w=g.length-1;w>-1&&(!m||!/^http(s?):/.test(m));)m=g[w--].src}if(!m)throw Error("Automatic publicPath is not supported in this browser");b.p=m.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},b.f.j=function(e,t){var n=b.o(s,e)?s[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=s[e]=[t,r]});t.push(n[2]=r);var i=b.p+b.u(e),o=Error();b.l(i,function(t){if(b.o(s,e)&&(0!==(n=s[e])&&(s[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+r+": "+i+")",o.name="ChunkLoadError",o.type=r,o.request=i,n[1](o)}},"chunk-"+e,e)}},f=function(e,t){var n,r,i=t[0],o=t[1],a=t[2],u=0;if(i.some(function(e){return 0!==s[e]})){for(n in o)b.o(o,n)&&(b.m[n]=o[n]);a&&a(b)}for(e&&e(t);u<i.length;u++)r=i[u],b.o(s,r)&&s[r]&&s[r][0](),s[r]=0},(p=self.webpackChunk_nocobase_plugin_verification_client_v2=self.webpackChunk_nocobase_plugin_verification_client_v2||[]).forEach(f.bind(null,0)),p.push=f.bind(null,p.push.bind(p));var S={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-verification/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",i=r.indexOf("/v2/");e=i>=0?r.slice(0,i+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-verification/dist/client-v2/"}b.p=e}(),!function(){b.r(S),b.d(S,{VerificationManager:function(){return r.X},default:function(){return t.A},SMS_OTP_VERIFICATION_TYPE:function(){return e.Fz},PROVIDER_TYPE_SMS_ALIYUN:function(){return e.ob},useT:function(){return n.kj},VerifierSelect:function(){return d},VerificationCode:function(){return v.n},NAMESPACE:function(){return n.CU},SMSOTPProviderManager:function(){return i.X},PROVIDER_TYPE_SMS_TENCENT:function(){return e.Zs},PluginVerificationClientV2:function(){return t.I},useVerificationTranslation:function(){return n.Au}});var e=b(624),t=b(373),n=b(816),r=b(319),i=b(261),o=b(485),a=b(694),u=b(59),c=b(155),l=b.n(c),s=b(442);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,i)}function d(e){var t,r=e.scene,i=e.value,d=e.onChange,v=e.multiple,b=e.placeholder,y=e.disabled,m=e.style,h=e.hideHint,g=(0,n.Au)().t,w=(0,n.kj)(),S=(0,a.useFlowContext)(),O=(0,c.useMemo)(function(){return"@nocobase/plugin-verification:verifiers:listByScene:".concat(r)},[r]),T=function(e){if(Array.isArray(e))return e}(t=(0,c.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],o=!0,a=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(i.push(t.value),2!==i.length);o=!0);}catch(e){a=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(a)throw n}}return i}}(t)||function(e){if(e){if("string"==typeof e)return f(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return f(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),P=T[0],E=T[1];return l().createElement(l().Fragment,null,l().createElement(o.RemoteSelect,{request:function(){var e;return(e=function(){var e,t,n;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:return[4,S.api.resource("verifiers").listByScene({scene:r})];case 1:return[2,null!=(e=null==(n=i.sent())||null==(t=n.data)?void 0:t.data)?e:{}]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){p(o,r,i,a,u,"next",e)}function u(e){p(o,r,i,a,u,"throw",e)}a(void 0)})})()},selectItems:function(e){return(null==e?void 0:e.verifiers)||[]},onLoaded:function(e,t){E(((null==t?void 0:t.availableTypes)||[]).map(function(e){return w(e.title||e.name)}))},cacheKey:O,refreshDeps:[r],mapOptions:function(e){return{label:w(e.title||e.name),value:e.name}},mode:v?"multiple":void 0,value:i,onChange:d,placeholder:b,disabled:y,style:m}),h?null:l().createElement(u.Typography.Text,{type:"secondary"},g("The following types of verifiers are available:")," ",P.join(", "),". ",g("Go to")," ",l().createElement(s.Link,{to:"/admin/settings/verification"},g("create verifiers"))))}var v=b(17)}(),S}()});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const NAMESPACE = "verification";
|
|
10
|
+
export declare const verificationLocaleResources: {
|
|
11
|
+
'en-US': {
|
|
12
|
+
"Access Key ID": string;
|
|
13
|
+
"Access Key Secret": string;
|
|
14
|
+
"Aliyun SMS": string;
|
|
15
|
+
Bind: string;
|
|
16
|
+
"Bound successfully": string;
|
|
17
|
+
Configured: string;
|
|
18
|
+
Endpoint: string;
|
|
19
|
+
"Get one-time codes sent to your phone via SMS to complete authentication requests.": string;
|
|
20
|
+
"Go to": string;
|
|
21
|
+
"Not a valid cellphone number, please re-enter": string;
|
|
22
|
+
"Not configured": string;
|
|
23
|
+
"Please don't retry in {{time}} seconds": string;
|
|
24
|
+
Provider: string;
|
|
25
|
+
"Provider type": string;
|
|
26
|
+
Region: string;
|
|
27
|
+
"SMS OTP": string;
|
|
28
|
+
"Secret Id": string;
|
|
29
|
+
"Secret Key": string;
|
|
30
|
+
Sign: string;
|
|
31
|
+
"Sign name": string;
|
|
32
|
+
"Sms sdk app id": string;
|
|
33
|
+
"Template Id": string;
|
|
34
|
+
"Template code": string;
|
|
35
|
+
"Tencent SMS": string;
|
|
36
|
+
"The following types of verifiers are available:": string;
|
|
37
|
+
"Too many failed attempts. Please request a new verification code.": string;
|
|
38
|
+
Unbind: string;
|
|
39
|
+
"Unbind verifier": string;
|
|
40
|
+
"Unbound successfully": string;
|
|
41
|
+
Verification: string;
|
|
42
|
+
"Verification code is invalid": string;
|
|
43
|
+
"Verification providers": string;
|
|
44
|
+
"Verification send failed, please try later or contact to administrator": string;
|
|
45
|
+
"Verification type": string;
|
|
46
|
+
Verifier: string;
|
|
47
|
+
Verifiers: string;
|
|
48
|
+
"You are trying so frequently, please slow down": string;
|
|
49
|
+
"create verifiers": string;
|
|
50
|
+
};
|
|
51
|
+
'zh-CN': {
|
|
52
|
+
"Access Key ID": string;
|
|
53
|
+
"Access Key Secret": string;
|
|
54
|
+
"Aliyun SMS": string;
|
|
55
|
+
Bind: string;
|
|
56
|
+
"Bound successfully": string;
|
|
57
|
+
Configured: string;
|
|
58
|
+
Endpoint: string;
|
|
59
|
+
"Get one-time codes sent to your phone via SMS to complete authentication requests.": string;
|
|
60
|
+
"Go to": string;
|
|
61
|
+
"Not a valid cellphone number, please re-enter": string;
|
|
62
|
+
"Not configured": string;
|
|
63
|
+
"Please don't retry in {{time}} seconds": string;
|
|
64
|
+
Provider: string;
|
|
65
|
+
"Provider type": string;
|
|
66
|
+
Region: string;
|
|
67
|
+
"SMS OTP": string;
|
|
68
|
+
"Secret Id": string;
|
|
69
|
+
"Secret Key": string;
|
|
70
|
+
Sign: string;
|
|
71
|
+
"Sign name": string;
|
|
72
|
+
"Sms sdk app id": string;
|
|
73
|
+
"Template Id": string;
|
|
74
|
+
"Template code": string;
|
|
75
|
+
"Tencent SMS": string;
|
|
76
|
+
"The following types of verifiers are available:": string;
|
|
77
|
+
"Too many failed attempts. Please request a new verification code.": string;
|
|
78
|
+
Unbind: string;
|
|
79
|
+
"Unbind verifier": string;
|
|
80
|
+
"Unbound successfully": string;
|
|
81
|
+
Verification: string;
|
|
82
|
+
"Verification code is invalid": string;
|
|
83
|
+
"Verification providers": string;
|
|
84
|
+
"Verification send failed, please try later or contact to administrator": string;
|
|
85
|
+
"Verification type": string;
|
|
86
|
+
Verifier: string;
|
|
87
|
+
Verifiers: string;
|
|
88
|
+
"You are trying so frequently, please slow down": string;
|
|
89
|
+
"create verifiers": string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export declare function useVerificationTranslation(): import("react-i18next").UseTranslationResponse<("verification" | "client")[], undefined>;
|
|
93
|
+
/**
|
|
94
|
+
* v2-style translator. Routes through `flowEngine.context.t`, which natively
|
|
95
|
+
* expands legacy Formily Schema templates (e.g. `{{t("Phone")}}`) — useful
|
|
96
|
+
* when the value comes from a server payload that still contains the
|
|
97
|
+
* `{{t("…")}}` wrapper.
|
|
98
|
+
*/
|
|
99
|
+
export declare function useT(): (key: string) => string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { ComponentType } from 'react';
|
|
10
|
+
type LoaderOf<P = Record<string, never>> = () => Promise<{
|
|
11
|
+
default: ComponentType<P>;
|
|
12
|
+
}>;
|
|
13
|
+
export type SMSOTPProviderOptions = {
|
|
14
|
+
components: {
|
|
15
|
+
/**
|
|
16
|
+
* Loader for the provider-specific admin-settings form. Stored as an
|
|
17
|
+
* async `() => import(...)` so third-party SMS providers contributed
|
|
18
|
+
* via `registerProvider()` come in as their own webpack chunk,
|
|
19
|
+
* fetched only when the corresponding provider is picked in the
|
|
20
|
+
* verifier configuration drawer.
|
|
21
|
+
*/
|
|
22
|
+
AdminSettingsFormLoader: LoaderOf;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Registry of SMS OTP providers (Aliyun, Tencent, …). Each entry only
|
|
27
|
+
* needs to contribute its admin settings form — the runtime side is
|
|
28
|
+
* handled server-side.
|
|
29
|
+
*/
|
|
30
|
+
export declare class SMSOTPProviderManager {
|
|
31
|
+
providers: any;
|
|
32
|
+
registerProvider(type: string, options: SMSOTPProviderOptions): void;
|
|
33
|
+
getProvider(type: string): any;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* Admin settings form for an SMS-OTP verifier:
|
|
12
|
+
* 1. `options.provider` selects which configured SMS provider (Aliyun /
|
|
13
|
+
* Tencent / …) sends the OTP. The list is the server resource
|
|
14
|
+
* `smsOTPProviders:list`.
|
|
15
|
+
* 2. `options.settings.*` is the provider-specific configuration form,
|
|
16
|
+
* looked up from the plugin's `smsOTPProviderManager` at runtime so
|
|
17
|
+
* third-party providers contributed via `registerProvider()` slot in
|
|
18
|
+
* automatically.
|
|
19
|
+
*/
|
|
20
|
+
export declare function AdminSettingsForm(): React.JSX.Element;
|
|
21
|
+
export default AdminSettingsForm;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import type { BindFormProps } from '../../verification-manager';
|
|
11
|
+
/**
|
|
12
|
+
* SMS-OTP bind form. Same shape as `VerificationForm` minus the bound
|
|
13
|
+
* publicInfo path — when binding, the user is always typing in a new
|
|
14
|
+
* phone number. Hosted inside the parent `<Form>` so `uuid` / `code`
|
|
15
|
+
* land on the parent's `form.values`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function BindForm(props: BindFormProps): React.JSX.Element;
|
|
18
|
+
export default BindForm;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import type { VerificationFormProps } from '../../verification-manager';
|
|
11
|
+
/**
|
|
12
|
+
* SMS-OTP verify form: phone number (read-only when bound) + verification
|
|
13
|
+
* code field paired with a "send code" button. Hosted inside a parent
|
|
14
|
+
* `<Form>` — antd Form.Item paths land on `uuid` (phone) and `code`,
|
|
15
|
+
* matching the v1 schema so server-side handlers are unchanged.
|
|
16
|
+
*/
|
|
17
|
+
export declare function VerificationForm(props: VerificationFormProps): React.JSX.Element;
|
|
18
|
+
export default VerificationForm;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const smsOTPVerificationOptions: {
|
|
10
|
+
components: {
|
|
11
|
+
VerificationFormLoader: () => Promise<typeof import("./VerificationForm")>;
|
|
12
|
+
AdminSettingsFormLoader: () => Promise<typeof import("./AdminSettingsForm")>;
|
|
13
|
+
BindFormLoader: () => Promise<typeof import("./BindForm")>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const smsAliyunProviderOptions: {
|
|
17
|
+
components: {
|
|
18
|
+
AdminSettingsFormLoader: () => Promise<typeof import("./providers/AliyunSettings")>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const smsTencentProviderOptions: {
|
|
22
|
+
components: {
|
|
23
|
+
AdminSettingsFormLoader: () => Promise<typeof import("./providers/TencentSettings")>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* Aliyun SMS provider settings. Field names match the v1 schema 1:1, so
|
|
12
|
+
* the persisted shape on the server is unchanged. Each value can be a
|
|
13
|
+
* literal credential or an `{{ $env.X }}` reference; secret fields use
|
|
14
|
+
* `EnvVariableInput`'s `password` mode to mask non-variable values.
|
|
15
|
+
*/
|
|
16
|
+
export declare function AliyunSettings(): React.JSX.Element;
|
|
17
|
+
export default AliyunSettings;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* Tencent SMS provider settings. Mirror of v1 schema; persisted payload
|
|
12
|
+
* keys are unchanged. Secret credentials use `EnvVariableInput`'s
|
|
13
|
+
* `password` mode so literal values are masked but `{{ $env.X }}`
|
|
14
|
+
* references stay editable through the picker.
|
|
15
|
+
*/
|
|
16
|
+
export declare function TencentSettings(): React.JSX.Element;
|
|
17
|
+
export default TencentSettings;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export type VerifierOptions = Record<string, unknown>;
|
|
11
|
+
export type VerifierRecord = {
|
|
12
|
+
name?: string;
|
|
13
|
+
title?: string | null;
|
|
14
|
+
description?: string | null;
|
|
15
|
+
verificationType?: string;
|
|
16
|
+
options?: VerifierOptions;
|
|
17
|
+
};
|
|
18
|
+
export type VerifierFormValues = {
|
|
19
|
+
name?: string;
|
|
20
|
+
title?: string | null;
|
|
21
|
+
description?: string | null;
|
|
22
|
+
verificationType?: string;
|
|
23
|
+
options?: VerifierOptions;
|
|
24
|
+
};
|
|
25
|
+
export declare function recursiveTrim<T>(value: T): T;
|
|
26
|
+
/**
|
|
27
|
+
* Submit pipeline for the create/edit verifier drawer.
|
|
28
|
+
*
|
|
29
|
+
* Extracted from the React component so the request layer can be tested
|
|
30
|
+
* directly without spinning up the full FlowEngine + viewer stack.
|
|
31
|
+
*
|
|
32
|
+
* The fallthrough `else` is deliberate — it converts what used to be a
|
|
33
|
+
* silent no-op (when `record.name` was undefined because we read the
|
|
34
|
+
* wrong primary key) into a loud error. The `verifiers` collection uses
|
|
35
|
+
* `name` as its primary key (`autoGenId: false`), so `filterByTk` must
|
|
36
|
+
* be the name string.
|
|
37
|
+
*/
|
|
38
|
+
export type VerifierResource = {
|
|
39
|
+
create(params: {
|
|
40
|
+
values: VerifierFormValues;
|
|
41
|
+
}): Promise<unknown>;
|
|
42
|
+
update(params: {
|
|
43
|
+
filterByTk: string;
|
|
44
|
+
values: VerifierFormValues;
|
|
45
|
+
}): Promise<unknown>;
|
|
46
|
+
};
|
|
47
|
+
export declare function submitVerifierForm(args: {
|
|
48
|
+
raw: VerifierFormValues;
|
|
49
|
+
mode: 'create' | 'edit';
|
|
50
|
+
record?: VerifierRecord;
|
|
51
|
+
resource: VerifierResource;
|
|
52
|
+
onSubmitted: () => void;
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Admin settings page for the Verification plugin. Lists all configured
|
|
56
|
+
* verifiers with create / edit / delete + bulk delete. Per-type fields
|
|
57
|
+
* are injected from `verificationManager` registered via the plugin
|
|
58
|
+
* registry so third-party verifier types (TOTP, future biometric, …)
|
|
59
|
+
* plug in without touching this page.
|
|
60
|
+
*/
|
|
61
|
+
export default function VerifiersPage(): React.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from '@nocobase/client-v2';
|
|
10
|
+
import { SMSOTPProviderManager } from './otp-sms-provider-manager';
|
|
11
|
+
import { VerificationManager } from './verification-manager';
|
|
12
|
+
/**
|
|
13
|
+
* v2 entry for the Verification plugin. Mirrors the v1 surface
|
|
14
|
+
* (`verificationManager` and `smsOTPProviderManager` instances exposed
|
|
15
|
+
* to downstream plugins) but plugs into the v2 lifecycle:
|
|
16
|
+
*
|
|
17
|
+
* - `pluginSettingsManager.addMenuItem` / `addPageTabItem` register the
|
|
18
|
+
* admin settings page with a lazy `componentLoader`.
|
|
19
|
+
* - `flowEngine.registerModels` contributes the User Center entry.
|
|
20
|
+
* - The legacy `src/client/` entry is intentionally left in place so
|
|
21
|
+
* downstream v1-only plugins (TOTP authenticator, 2FA pro plugin)
|
|
22
|
+
* keep working until they migrate independently.
|
|
23
|
+
*/
|
|
24
|
+
export declare class PluginVerificationClientV2 extends Plugin {
|
|
25
|
+
verificationManager: VerificationManager;
|
|
26
|
+
smsOTPProviderManager: SMSOTPProviderManager;
|
|
27
|
+
load(): Promise<void>;
|
|
28
|
+
private registerSettingsPages;
|
|
29
|
+
}
|
|
30
|
+
export default PluginVerificationClientV2;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* Drawer content for the User Center's "Verification" entry. Lists
|
|
12
|
+
* every verifier the current user can bind/unbind, with a Configured /
|
|
13
|
+
* Not configured tag and a per-row action. Bind opens a type-specific
|
|
14
|
+
* sub-drawer; Unbind opens a Tabs-based confirmation drawer that
|
|
15
|
+
* authenticates the user with any other bound verifier before removing
|
|
16
|
+
* the target.
|
|
17
|
+
*/
|
|
18
|
+
export declare function MyVerifiers(): React.JSX.Element;
|
|
19
|
+
export default MyVerifiers;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { UserCenterActionItemModel } from '@nocobase/client-v2';
|
|
10
|
+
/**
|
|
11
|
+
* User Center entry that opens the "My verifiers" drawer. Section is
|
|
12
|
+
* `profile` so it sits next to language / theme controls. Sort is
|
|
13
|
+
* tightened to 150 to match v1's ordering, where Verification lived
|
|
14
|
+
* between Profile (100) and Theme (200).
|
|
15
|
+
*
|
|
16
|
+
* The base `UserCenterTextItemView` renders `getLabelNode()`, which by
|
|
17
|
+
* default routes through `this.context.t(label)` with no namespace —
|
|
18
|
+
* that would never resolve the verification-namespaced key. Override
|
|
19
|
+
* the node directly so the verification i18n namespace is consulted.
|
|
20
|
+
*/
|
|
21
|
+
export declare class VerificationUserCenterItemModel extends UserCenterActionItemModel {
|
|
22
|
+
static itemId: string;
|
|
23
|
+
section: "profile";
|
|
24
|
+
sort: number;
|
|
25
|
+
label: string;
|
|
26
|
+
getLabelNode(): string;
|
|
27
|
+
onClick(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export default VerificationUserCenterItemModel;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { ComponentType } from 'react';
|
|
10
|
+
export type VerificationFormProps = {
|
|
11
|
+
verifier: string;
|
|
12
|
+
actionType: string;
|
|
13
|
+
boundInfo?: {
|
|
14
|
+
bound?: boolean;
|
|
15
|
+
publicInfo?: any;
|
|
16
|
+
};
|
|
17
|
+
isLogged?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type BindFormProps = {
|
|
20
|
+
verifier: string;
|
|
21
|
+
actionType: string;
|
|
22
|
+
isLogged?: boolean;
|
|
23
|
+
};
|
|
24
|
+
type LoaderOf<P = Record<string, never>> = () => Promise<{
|
|
25
|
+
default: ComponentType<P>;
|
|
26
|
+
}>;
|
|
27
|
+
export type VerificationTypeOptions = {
|
|
28
|
+
/**
|
|
29
|
+
* Async loaders for the type-specific forms. The manager stores loaders
|
|
30
|
+
* rather than direct component references so each verifier type
|
|
31
|
+
* contributes its own webpack chunk and is only fetched when a verifier
|
|
32
|
+
* of that type is actually shown.
|
|
33
|
+
*
|
|
34
|
+
* Consumers wrap each loader with `React.lazy` (cached via `useMemo` or
|
|
35
|
+
* a per-type cache to avoid re-creating the lazy wrapper) and render it
|
|
36
|
+
* under `<Suspense>`.
|
|
37
|
+
*/
|
|
38
|
+
components: {
|
|
39
|
+
AdminSettingsFormLoader?: LoaderOf;
|
|
40
|
+
VerificationFormLoader?: LoaderOf<VerificationFormProps>;
|
|
41
|
+
BindFormLoader?: LoaderOf<BindFormProps>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare class VerificationManager {
|
|
45
|
+
verifications: any;
|
|
46
|
+
registerVerificationType(type: string, options: VerificationTypeOptions): void;
|
|
47
|
+
getVerification(type: string): any;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,21 +8,24 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.36",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"antd": "5.24.2",
|
|
14
14
|
"@formily/shared": "2.3.7",
|
|
15
15
|
"@formily/react": "2.3.7",
|
|
16
16
|
"@formily/core": "2.3.7",
|
|
17
|
-
"@nocobase/
|
|
18
|
-
"@nocobase/utils": "2.1.0-beta.34",
|
|
19
|
-
"@nocobase/cache": "2.1.0-beta.34",
|
|
20
|
-
"@nocobase/actions": "2.1.0-beta.34",
|
|
21
|
-
"@nocobase/database": "2.1.0-beta.34",
|
|
17
|
+
"@nocobase/flow-engine": "2.1.0-beta.36",
|
|
22
18
|
"react-i18next": "11.18.6",
|
|
19
|
+
"@nocobase/utils": "2.1.0-beta.36",
|
|
20
|
+
"@nocobase/client-v2": "2.1.0-beta.36",
|
|
21
|
+
"@nocobase/server": "2.1.0-beta.36",
|
|
22
|
+
"@nocobase/cache": "2.1.0-beta.36",
|
|
23
|
+
"@nocobase/actions": "2.1.0-beta.36",
|
|
24
|
+
"@nocobase/database": "2.1.0-beta.36",
|
|
23
25
|
"react-router-dom": "6.30.1",
|
|
24
26
|
"@formily/antd-v5": "1.2.3",
|
|
25
27
|
"@ant-design/icons": "5.6.1",
|
|
28
|
+
"ahooks": "3.7.8",
|
|
26
29
|
"lodash": "4.18.1",
|
|
27
30
|
"dayjs": "1.11.13"
|
|
28
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@alicloud/dysmsapi20170525","version":"2.0.17","description":"","main":"dist/client.js","scripts":{"test":"mocha --reporter spec --timeout 3000 test/*.test.js","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Alibaba Cloud SDK","license":"Apache-2.0","devDependencies":{"@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.4","@alicloud/openapi-client":"^0.4.1","@alicloud/endpoint-util":"^0.0.1","@alicloud/openapi-util":"^0.2.9"},"files":["dist","src"],"_lastModified":"2026-05-
|
|
1
|
+
{"name":"@alicloud/dysmsapi20170525","version":"2.0.17","description":"","main":"dist/client.js","scripts":{"test":"mocha --reporter spec --timeout 3000 test/*.test.js","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Alibaba Cloud SDK","license":"Apache-2.0","devDependencies":{"@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.4","@alicloud/openapi-client":"^0.4.1","@alicloud/endpoint-util":"^0.0.1","@alicloud/openapi-util":"^0.2.9"},"files":["dist","src"],"_lastModified":"2026-05-21T16:55:07.378Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@alicloud/openapi-client","version":"0.4.12","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts --timeout=10000","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/mocha":"^5.2.7","mocha":"^6.2.0","@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5","@alicloud/gateway-pop":"0.0.6"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.9","@alicloud/credentials":"^2.3.1","@alicloud/openapi-util":"^0.3.2","@alicloud/gateway-spi":"^0.0.8","@alicloud/tea-xml":"0.0.3"},"files":["dist","src"],"repository":"git@github.com:aliyun/darabonba-openapi.git","_lastModified":"2026-05-
|
|
1
|
+
{"name":"@alicloud/openapi-client","version":"0.4.12","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts --timeout=10000","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/mocha":"^5.2.7","mocha":"^6.2.0","@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5","@alicloud/gateway-pop":"0.0.6"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.9","@alicloud/credentials":"^2.3.1","@alicloud/openapi-util":"^0.3.2","@alicloud/gateway-spi":"^0.0.8","@alicloud/tea-xml":"0.0.3"},"files":["dist","src"],"repository":"git@github.com:aliyun/darabonba-openapi.git","_lastModified":"2026-05-21T16:55:08.230Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@alicloud/tea-util","version":"1.4.4","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Jackson Tian","license":"Apache-2.0","devDependencies":{"@types/mocha":"^7.0.1","@types/node":"^12.12.26","mocha":"^7.0.1","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.5.1","kitx":"^2.0.0"},"files":["dist","src"],"_lastModified":"2026-05-
|
|
1
|
+
{"name":"@alicloud/tea-util","version":"1.4.4","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Jackson Tian","license":"Apache-2.0","devDependencies":{"@types/mocha":"^7.0.1","@types/node":"^12.12.26","mocha":"^7.0.1","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.5.1","kitx":"^2.0.0"},"files":["dist","src"],"_lastModified":"2026-05-21T16:55:08.438Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"tencentcloud-sdk-nodejs-sms","version":"4.1.171","description":"腾讯云 API NODEJS SDK","main":"./tencentcloud/index.js","module":"./es/index.js","types":"./tencentcloud/index.d.ts","scripts":{"test":"mocha -t 10000","build":"concurrently 'npm:build:cjs' 'npm:build:es'","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig.es.json","build:slim":"node ./scripts/build_slim.js","prettier":"prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'","clean":"rimraf tencentcloud es","test:common":"vitest run"},"engines":{"node":">=10"},"files":["tencentcloud","es"],"keywords":["tencentcloudapi","tencentcloud","qcloud","sdk","js","nodejs"],"author":"tencentcloudapi","license":"Apache-2.0","dependencies":{"tencentcloud-sdk-nodejs-common":"*","tslib":"1.13.0"},"directories":{"example":"examples","lib":"lib"},"repository":{"type":"git","url":"https://github.com/tencentcloud/tencentcloud-sdk-nodejs"},"devDependencies":{"@types/ini":"^4.1.1","@types/json-bigint":"^1.0.1","@types/node":"^18.0.0","@types/node-fetch":"^2.5.7","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","babel-eslint":"^10.0.2","chai":"^4.2.0","concurrently":"^6.5.1","esbuild":"^0.25.0","eslint":"^6.8.0","eslint-plugin-react":"^7.17.0","mocha":"^8.4.0","prettier":"^2.3.0","rimraf":"^5.0.10","ts-node":"^8.10.2","typescript":"^5.9.2","vitest":"2.1.9"},"_lastModified":"2026-05-
|
|
1
|
+
{"name":"tencentcloud-sdk-nodejs-sms","version":"4.1.171","description":"腾讯云 API NODEJS SDK","main":"./tencentcloud/index.js","module":"./es/index.js","types":"./tencentcloud/index.d.ts","scripts":{"test":"mocha -t 10000","build":"concurrently 'npm:build:cjs' 'npm:build:es'","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig.es.json","build:slim":"node ./scripts/build_slim.js","prettier":"prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'","clean":"rimraf tencentcloud es","test:common":"vitest run"},"engines":{"node":">=10"},"files":["tencentcloud","es"],"keywords":["tencentcloudapi","tencentcloud","qcloud","sdk","js","nodejs"],"author":"tencentcloudapi","license":"Apache-2.0","dependencies":{"tencentcloud-sdk-nodejs-common":"*","tslib":"1.13.0"},"directories":{"example":"examples","lib":"lib"},"repository":{"type":"git","url":"https://github.com/tencentcloud/tencentcloud-sdk-nodejs"},"devDependencies":{"@types/ini":"^4.1.1","@types/json-bigint":"^1.0.1","@types/node":"^18.0.0","@types/node-fetch":"^2.5.7","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","babel-eslint":"^10.0.2","chai":"^4.2.0","concurrently":"^6.5.1","esbuild":"^0.25.0","eslint":"^6.8.0","eslint-plugin-react":"^7.17.0","mocha":"^8.4.0","prettier":"^2.3.0","rimraf":"^5.0.10","ts-node":"^8.10.2","typescript":"^5.9.2","vitest":"2.1.9"},"_lastModified":"2026-05-21T16:55:09.634Z"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "User identity verification management, including SMS, TOTP authenticator, with extensibility.",
|
|
7
7
|
"description.ru-RU": "Управление проверкой личности пользователя, включая SMS, TOTP-авторизацию, с возможностью расширения.",
|
|
8
8
|
"description.zh-CN": "用户身份验证管理,包含短信、TOTP 认证器等,可扩展。",
|
|
9
|
-
"version": "2.1.0-beta.
|
|
9
|
+
"version": "2.1.0-beta.36",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/verification",
|
|
@@ -28,13 +28,15 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@nocobase/actions": "2.x",
|
|
30
30
|
"@nocobase/client": "2.x",
|
|
31
|
+
"@nocobase/client-v2": "2.x",
|
|
31
32
|
"@nocobase/database": "2.x",
|
|
33
|
+
"@nocobase/flow-engine": "2.x",
|
|
32
34
|
"@nocobase/resourcer": "2.x",
|
|
33
35
|
"@nocobase/server": "2.x",
|
|
34
36
|
"@nocobase/test": "2.x",
|
|
35
37
|
"@nocobase/utils": "2.x"
|
|
36
38
|
},
|
|
37
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "397d45c744f6eb48b3a0cd785c87cbf1257c3513",
|
|
38
40
|
"keywords": [
|
|
39
41
|
"Authentication",
|
|
40
42
|
"Verification",
|