@nocobase/plugin-auth 1.7.0-beta.1 → 1.7.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/2fde58876f8f8762.js +10 -0
- package/dist/client/{0091d4359312cb07.js → 49850b42bb3c17b7.js} +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +1 -1
- package/dist/client/settings/Authenticator.d.ts +6 -0
- package/dist/externalVersion.js +11 -11
- package/dist/locale/de-DE.json +50 -0
- package/dist/locale/it-IT.json +23 -1
- package/dist/locale/nl-NL.json +33 -0
- package/dist/node_modules/cron/package.json +1 -1
- package/dist/node_modules/ms/package.json +1 -1
- package/dist/server/locale/nl-NL.json +8 -0
- package/dist/server/plugin.js +3 -3
- package/package.json +2 -2
- package/dist/client/974ac9de644a1d1f.js +0 -10
|
@@ -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_auth=self.webpackChunk_nocobase_plugin_auth||[]).push([["851"],{264:function(e,t,n){n.r(t),n.d(t,{Authenticator:function(){return V},useCreateAction:function(){return R},useUpdateAction:function(){return _}});var o=n("772"),r=n("721"),i=n("156"),c=n.n(i),a=n("875"),u=n("238"),s=(0,i.createContext)({type:""});s.displayName="AuthTypeContext";var l=(0,i.createContext)({types:[]});l.displayName="AuthTypesContext";function p(e,t,n,o,r,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(o,r)}var m={name:"authenticators",sortable:!0,fields:[{name:"id",type:"string",interface:"id"},{interface:"input",type:"string",name:"name",uiSchema:{type:"string",title:'{{t("Auth UID")}}',"x-component":"Input","x-validator":function(e){return/^[a-zA-Z0-9_-]+$/.test(e)?"":o.i18n.t("a-z, A-Z, 0-9, _, -")},required:!0}},{interface:"input",type:"string",name:"authType",uiSchema:{type:"string",title:'{{t("Auth Type")}}',"x-component":"Select",dataSource:"{{ types }}",required:!0}},{interface:"input",type:"string",name:"title",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"textarea",type:"string",name:"description",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input"}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},d={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:function(e){var t,n,r=(0,o.useActionContext)(),c=(0,i.useContext)(s).type;return(0,o.useRequest)(function(){return Promise.resolve({data:{name:"s_".concat((0,a.uid)()),authType:c}})},(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}({},e),n=(n={refreshDeps:[r.visible]},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}},title:'{{t("Add new")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateAction }}"}}}}}}}},y={type:"void",name:"authenticators","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:m,resourceName:"authenticators",dragSort:!0,request:{resource:"authenticators",action:"list",params:{pageSize:50,sort:"sort",appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:m},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"AddNew","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction:function(){var e=(0,o.useAPIClient)(),t=(0,u.useTranslation)().t;return{move:function(n,o){var i;return(i=function(){return function(e,t){var n,o,r,i,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,o=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){c=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){c.label=i[1];break}if(6===i[0]&&c.label<r[1]){c.label=r[1],r=i;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(i);break}r[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(i){switch(i.label){case 0:return[4,e.resource("authenticators").move({sourceId:n.id,targetId:o.id})];case 1:return i.sent(),r.message.success(t("Saved successfully"),.2),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var r=i.apply(e,t);function c(e){p(r,n,o,c,a,"next",e)}function a(e){p(r,n,o,c,a,"throw",e)}c(void 0)})})()}}}},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0,enum:"{{ types }}"}}},title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Configure")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"},"x-disabled":"{{ useCanNotDelete() }}"}}}}}}}}},f=n("482"),b=n("505"),v=n("851");function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}var h=function(e){var t,n,r=(0,o.useRecord)();var c=(0,o.useRequest)(function(){return Promise.resolve({data:x({},r.options)})},(t=x({},e),n=(n={manual:!0},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)),a=c.run,u=(0,o.useActionContext)();return(0,i.useEffect)(function(){u.visible&&a()},[u.visible,a]),c},O=function(e){var t,n=(0,o.usePlugin)(v.default).authTypes.get(e);return null==n?void 0:null===(t=n.components)||void 0===t?void 0:t.AdminSettingsForm},g=(0,b.observer)(function(){var e=(0,b.useForm)(),t=(0,o.useRecord)(),n=O(e.values.authType||t.authType);return n?c().createElement(n,null):null},{displayName:"Options"}),A=n("573");function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function w(e,t,n,o,r,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(o,r)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(o,r){var i=e.apply(t,n);function c(e){w(i,o,r,c,a,"next",e)}function a(e){w(i,o,r,c,a,"throw",e)}c(void 0)})}}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}function S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],c=!0,a=!1;try{for(r=r.call(e);!(c=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{!c&&null!=r.return&&r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(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 C(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 F(e,t){var n,o,r,i,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,o=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){c=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){c.label=i[1];break}if(6===i[0]&&c.label<r[1]){c.label=r[1],r=i;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(i);break}r[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function T(e){var t;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(function(e){return T(e)});return(void 0===e?"undefined":(t=e)&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)=="object"&&null!==e?Object.fromEntries(Object.entries(e).map(function(e){var t=D(e,2);return[t[0],T(t[1])]})):e}var k=function(){var e=(0,o.useActionContext)().setVisible;return{run:function(){return j(function(){return F(this,function(t){return e(!1),[2]})})()}}},E=function(){var e=(0,u.useTranslation)().t,t=D((0,i.useState)(!1),2),n=t[0],a=t[1],p=D((0,i.useState)(""),2),m=p[0],y=p[1],b=(0,i.useContext)(l).types,v=b.map(function(e){return S(P({},e),{onClick:function(){a(!0),y(e.value)}})});return c().createElement(o.ActionContextProvider,{value:{visible:n,setVisible:a}},c().createElement(s.Provider,{value:{type:m}},c().createElement(r.Dropdown,{menu:{items:v}},c().createElement(r.Button,{icon:c().createElement(f.PlusOutlined,null),type:"primary"},e("Add new")," ",c().createElement(f.DownOutlined,null))),c().createElement(o.SchemaComponent,{scope:{useCloseAction:k,types:b,setType:y,useCreateAction:R},schema:d})))},I=function(){return(0,o.useAsyncData)().data,!1},R=function(){var e=(0,b.useForm)(),t=(0,b.useField)(),n=(0,o.useActionContext)(),r=(0,o.useResourceActionContext)().refresh,i=(0,o.useResourceContext)().resource;return{run:function(){return j(function(){var o,c;return F(this,function(c){switch(c.label){case 0:return c.trys.push([0,4,,5]),[4,e.submit()];case 1:return c.sent(),t.data=t.data||{},t.data.loading=!0,o=e.values.options||{},[4,i.create({values:S(P({},e.values),{options:T(o)})})];case 2:return c.sent(),n.setVisible(!1),[4,e.reset()];case 3:return c.sent(),t.data.loading=!1,r(),[3,5];case 4:return c.sent(),t.data&&(t.data.loading=!1),[3,5];case 5:return[2]}})})()}}},_=function(){var e=(0,b.useField)(),t=(0,b.useForm)(),n=(0,o.useActionContext)(),r=(0,o.useResourceActionContext)().refresh,i=(0,o.useResourceContext)(),c=i.resource,a=i.targetKey,u=(0,o.useRecord)()[a];return{run:function(){return j(function(){var o;return F(this,function(i){switch(i.label){case 0:return[4,t.submit()];case 1:i.sent(),e.data=e.data||{},e.data.loading=!0,i.label=2;case 2:return i.trys.push([2,5,6,7]),o=t.values.options||{},[4,c.update({filterByTk:u,values:S(P({},t.values),{options:T(o)})})];case 3:return i.sent(),n.setVisible(!1),[4,t.reset()];case 4:return i.sent(),r(),[3,7];case 5:return console.log(i.sent()),[3,7];case 6:return e.data.loading=!1,[7];case 7:return[2]}})})()}}},V=function(){var e=(0,A.o$)().t,t=D((0,i.useState)([]),2),n=t[0],a=t[1],u=(0,o.useAPIClient)();return(0,o.useRequest)(function(){return u.resource("authenticators").listTypes().then(function(t){var n;return((null==t?void 0:null===(n=t.data)||void 0===n?void 0:n.data)||[]).map(function(t){return{key:t.name,label:b.Schema.compile(t.title||t.name,{t:e}),value:t.name}})})},{onSuccess:function(e){a(e)}}),c().createElement(r.Card,{bordered:!1},c().createElement(l.Provider,{value:{types:n}},c().createElement(o.SchemaComponent,{schema:y,components:{AddNew:E,Options:g},scope:{types:n,useValuesFromOptions:h,useCanNotDelete:I,t:e,useUpdateAction:_}})))}}}]);
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).push([["938"],{510:function(e,t,n){n.r(t),n.d(t,{Options:function(){return C},SignInForm:function(){return y},SignUpForm:function(){return P},useRedirect:function(){return m},useSignUp:function(){return O},useSignIn:function(){return f}});var r=n("772"),o=n("156"),i=n.n(o),a=n("573"),u=n("128"),c=n("505"),s=n(581);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 p(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function m(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e,t,n=(0,u.useNavigate)();var r=(e=(0,u.useSearchParams)(),t=1,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(u)throw r}}return i}}(e,1)||function(e,t){if(e){if("string"==typeof e)return l(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 l(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.")}())[0];return(0,o.useCallback)(function(){n(r.get("redirect")||"/admin",{replace:!0})},[n,r])}var f=function(e){var t=(0,c.useForm)(),n=(0,r.useAPIClient)(),o=m(),i=(0,r.useCurrentUserContext)().refreshAsync;return{run:function(){var r;return(r=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,function(r){switch(r.label){case 0:return[4,t.submit()];case 1:return r.sent(),[4,n.auth.signIn(t.values,e)];case 2:return r.sent(),[4,i()];case 3:return r.sent(),o(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){p(i,n,o,a,u,"next",e)}function u(e){p(i,n,o,a,u,"throw",e)}a(void 0)})})()}}},d={type:"object",name:"passwordForm","x-component":"FormV2",properties:{account:{type:"string","x-component":"Input","x-validator":'{{(value) => {\n if (!value) {\n return t("Please enter your username or email");\n }\n if (value.includes(\'@\')) {\n if (!/^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$/.test(value)) {\n return t("Please enter a valid email");\n }\n } else {\n return /^[^@.<>"\'/]{1,50}$/.test(value) || t("Please enter a valid username");\n }\n }}}',"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username/Email")}}',style:{}}},password:{type:"string","x-component":"Password",required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign in")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:"{{ useBasicSignIn }}",style:{width:"100%"}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"{{ signUpLink }}"},"x-content":'{{t("Create an account")}}',"x-visible":"{{ allowSignUp }}"}}},y=function(e){var t=(0,a.o$)().t,o=e.authenticator,u=o.authType,c=o.name,l=o.options,p=!!(0,r.useLazy)(function(){return s("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"useSignUpForms")()[u]&&null!=l&&!!l.allowSignUp,m="/signup?name=".concat(c);return i().createElement(r.SchemaComponent,{schema:d,scope:{useBasicSignIn:function(){return f(c)},allowSignUp:p,signUpLink:m,t:t}})},b=n("875"),v=n("721"),h=n("238"),g=n("308");function w(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function x(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var O=function(e){var t=(0,u.useNavigate)(),n=(0,c.useForm)(),o=(0,r.useAPIClient)(),i=(0,h.useTranslation)().t;return{run:function(){var r;return(r=function(){var r;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,function(a){switch(a.label){case 0:return[4,n.submit()];case 1:return a.sent(),[4,o.auth.signUp(n.values,null==e?void 0:e.authenticator)];case 2:return a.sent(),v.message.success((null==e?void 0:null===(r=e.message)||void 0===r?void 0:r.success)||i("Sign up successfully, and automatically jump to the sign in page")),setTimeout(function(){t("/signin")},2e3),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){w(i,n,o,a,u,"next",e)}function u(e){w(i,n,o,a,u,"throw",e)}a(void 0)})})()}}},P=function(e){var t,n=e.authenticatorName,c=(0,a.o$)().t,s=(0,g.u)(n).options,l=s.signupForm,p=(0,o.useMemo)(function(){return l.filter(function(e){return e.show}).reduce(function(e,t){return e[t.field]=S(x({},t.uiSchema),{required:t.required,"x-decorator":"FormItem"}),e},{})},[l]);if(!(null==s?void 0:s.allowSignUp))return i().createElement(u.Navigate,{to:"/not-found",replace:!0});var m=(t=p,{type:"object",name:(0,b.uid)(),"x-component":"FormV2",properties:S(x({},t),{password:{type:"string",required:!0,title:'{{t("Password")}}',"x-component":"Password","x-decorator":"FormItem","x-validator":{password:!0},"x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirm_password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirm_password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem",title:'{{t("Confirm password")}}',"x-validator":{password:!0},"x-component-props":{style:{}},"x-reactions":[{dependencies:[".password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign up")}}',type:"void","x-component":"Action","x-component-props":{block:!0,type:"primary",htmlType:"submit",useAction:"{{ useBasicSignUp }}",style:{width:"100%"}}}}},link:{type:"void","x-component":"div",properties:{link:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Log in with an existing account")}}'}}}})});return i().createElement(r.SchemaComponent,{schema:m,scope:{useBasicSignUp:function(){return O({authenticator:n})},t:c}})},j=n("632");function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(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){k(e,t,n[t])})}return e}function A(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var I=function(){var e=(0,r.useRecord)(),t=(0,r.useCollectionManager)().getCollection("users").fields.filter(function(e){var t;return!e.hidden&&!e.target&&e.interface&&!(null===(t=e.uiSchema)||void 0===t?void 0:t["x-read-pretty"])}),n=t.map(function(e){var t;return{value:e.name,label:null===(t=e.uiSchema)||void 0===t?void 0:t.title}}),u=(0,o.useMemo)(function(){var n=((null===(u=e.options)||void 0===u?void 0:null===(a=u.public)||void 0===a?void 0:a.signupForm)||[]).filter(function(e){return t.find(function(t){return t.name===e.field})}),r=!0,o=!1,i=void 0;try{for(var a,u,c,s=t[Symbol.iterator]();!(r=(c=s.next()).done);r=!0)!function(){var e=c.value;!n.find(function(t){return t.field===e.name})&&n.push({field:e.name,show:"username"===e.name,required:"username"===e.name})}()}catch(e){o=!0,i=e}finally{try{!r&&null!=s.return&&s.return()}finally{if(o)throw i}}return n},[t,e]);return(0,o.useEffect)(function(){var t;e.options=A(F({},e.options),{public:A(F({},null===(t=e.options)||void 0===t?void 0:t.public),{signupForm:u})})},[e,u]),i().createElement(r.SchemaComponent,{components:{ArrayTable:j.ArrayTable},schema:{type:"void",properties:{signupForm:{title:'{{t("Sign up form")}}',type:"array","x-decorator":"FormItem","x-component":"ArrayTable","x-component-props":{bordered:!1},"x-validator":"{{ (value) => {\n const check = value?.some((item) => ['username', 'email'].includes(item.field) && item.show && item.required);\n if (!check) {\n return t('At least one of the username or email fields is required');\n }\n} }}",default:u,items:{type:"object","x-decorator":"ArrayItems.Item",properties:{column0:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:20,align:"center"},properties:{sort:{type:"void","x-component":"ArrayTable.SortHandle"}}},column1:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:100,title:(0,a.KQ)("Field")},properties:{field:{type:"string","x-decorator":"FormItem","x-component":"Select",enum:n,"x-read-pretty":!0}}},column2:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:80,title:(0,a.KQ)("Show")},properties:{show:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:[".required"],fulfill:{state:{value:"{{ $deps[0] || $self.value }}"}}}}}},column3:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:80,title:(0,a.KQ)("Required")},properties:{required:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:[".show"],fulfill:{state:{value:"{{ !$deps[0] ? false : $self.value }}"}}}}}}}}}}}})},C=function(){var e=(0,a.o$)().t;return i().createElement(r.SchemaComponent,{scope:{t:e},components:{Alert:v.Alert,SignupFormSettings:I,FormTab:j.FormTab},schema:{type:"object",properties:{notice:{type:"void","x-decorator":"FormItem","x-component":"Alert","x-component-props":{showIcon:!0,message:'{{t("The authentication allows users to sign in via username or email.")}}'}},public:{type:"object",properties:{collapse:{type:"void","x-component":"FormTab",properties:{basic:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:(0,a.KQ)("Sign up settings")},properties:k({allowSignUp:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Allow to sign up")}}',"x-component":"Checkbox",default:!0}},(0,b.uid)(),{type:"void","x-component":"SignupFormSettings"})}}}}}}}})}}}]);
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).push([["938"],{510:function(e,t,n){n.r(t),n.d(t,{Options:function(){return C},SignInForm:function(){return y},SignUpForm:function(){return P},useRedirect:function(){return m},useSignUp:function(){return O},useSignIn:function(){return f}});var r=n("772"),o=n("156"),i=n.n(o),a=n("573"),u=n("128"),c=n("505"),s=n(581);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 p(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function m(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e,t,n=(0,u.useNavigate)();var r=(e=(0,u.useSearchParams)(),t=1,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(u)throw r}}return i}}(e,1)||function(e,t){if(e){if("string"==typeof e)return l(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 l(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.")}())[0];return(0,o.useCallback)(function(){n(r.get("redirect")||"/admin",{replace:!0})},[n,r])}var f=function(e){var t=(0,c.useForm)(),n=(0,r.useAPIClient)(),o=m(),i=(0,r.useCurrentUserContext)().refreshAsync;return{run:function(){var r;return(r=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,function(r){switch(r.label){case 0:return[4,t.submit()];case 1:return r.sent(),[4,n.auth.signIn(t.values,e)];case 2:return r.sent(),[4,i()];case 3:return r.sent(),o(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){p(i,n,o,a,u,"next",e)}function u(e){p(i,n,o,a,u,"throw",e)}a(void 0)})})()}}},d={type:"object",name:"passwordForm","x-component":"FormV2",properties:{account:{type:"string","x-component":"Input","x-validator":'{{(value) => {\n if (!value) {\n return t("Please enter your username or email");\n }\n if (value.includes(\'@\')) {\n if (!/^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$/.test(value)) {\n return t("Please enter a valid email");\n }\n } else {\n return /^[^@.<>"\'/]{1,50}$/.test(value) || t("Please enter a valid username");\n }\n }}}',"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username/Email")}}',style:{}}},password:{type:"string","x-component":"Password",required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign in")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:"{{ useBasicSignIn }}",style:{width:"100%"}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"{{ signUpLink }}"},"x-content":'{{t("Create an account")}}',"x-visible":"{{ allowSignUp }}"}}},y=function(e){var t=(0,a.o$)().t,o=e.authenticator,u=o.authType,c=o.name,l=o.options,p=!!(0,r.useLazy)(function(){return s("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"useSignUpForms")()[u]&&null!=l&&!!l.allowSignUp,m="/signup?name=".concat(c);return i().createElement(r.SchemaComponent,{schema:d,scope:{useBasicSignIn:function(){return f(c)},allowSignUp:p,signUpLink:m,t:t}})},b=n("875"),v=n("721"),h=n("238"),g=n("308");function w(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function x(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var O=function(e){var t=(0,u.useNavigate)(),n=(0,c.useForm)(),o=(0,r.useAPIClient)(),i=(0,h.useTranslation)().t;return{run:function(){var r;return(r=function(){var r;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,function(a){switch(a.label){case 0:return[4,n.submit()];case 1:return a.sent(),[4,o.auth.signUp(n.values,null==e?void 0:e.authenticator)];case 2:return a.sent(),v.message.success((null==e?void 0:null===(r=e.message)||void 0===r?void 0:r.success)||i("Sign up successfully, and automatically jump to the sign in page")),setTimeout(function(){t("/signin")},2e3),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){w(i,n,o,a,u,"next",e)}function u(e){w(i,n,o,a,u,"throw",e)}a(void 0)})})()}}},P=function(e){var t,n=e.authenticatorName,s=(0,a.o$)().t,l=(0,h.useTranslation)("lm-collections").t,p=(0,g.u)(n).options,m=p.signupForm,f=(0,o.useMemo)(function(){return m.filter(function(e){return e.show}).reduce(function(e,t){var n=S(x({},t.uiSchema),{title:t.uiSchema.title?l(c.Schema.compile(t.uiSchema.title,{t:s})):""});return e[t.field]=S(x({},n),{required:t.required,"x-decorator":"FormItem"}),e},{})},[m]);if(!(null==p?void 0:p.allowSignUp))return i().createElement(u.Navigate,{to:"/not-found",replace:!0});var d=(t=f,{type:"object",name:(0,b.uid)(),"x-component":"FormV2",properties:S(x({},t),{password:{type:"string",required:!0,title:'{{t("Password")}}',"x-component":"Password","x-decorator":"FormItem","x-validator":{password:!0},"x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirm_password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirm_password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem",title:'{{t("Confirm password")}}',"x-validator":{password:!0},"x-component-props":{style:{}},"x-reactions":[{dependencies:[".password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign up")}}',type:"void","x-component":"Action","x-component-props":{block:!0,type:"primary",htmlType:"submit",useAction:"{{ useBasicSignUp }}",style:{width:"100%"}}}}},link:{type:"void","x-component":"div",properties:{link:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Log in with an existing account")}}'}}}})});return i().createElement(r.SchemaComponent,{schema:d,scope:{useBasicSignUp:function(){return O({authenticator:n})},t:s}})},j=n("632");function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(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){k(e,t,n[t])})}return e}function A(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var I=function(){var e=(0,r.useRecord)(),t=(0,r.useCollectionManager)().getCollection("users").fields.filter(function(e){var t;return!e.hidden&&!e.target&&e.interface&&!(null===(t=e.uiSchema)||void 0===t?void 0:t["x-read-pretty"])}),n=t.map(function(e){var t;return{value:e.name,label:null===(t=e.uiSchema)||void 0===t?void 0:t.title}}),u=(0,o.useMemo)(function(){var n=((null===(u=e.options)||void 0===u?void 0:null===(a=u.public)||void 0===a?void 0:a.signupForm)||[]).filter(function(e){return t.find(function(t){return t.name===e.field})}),r=!0,o=!1,i=void 0;try{for(var a,u,c,s=t[Symbol.iterator]();!(r=(c=s.next()).done);r=!0)!function(){var e=c.value;!n.find(function(t){return t.field===e.name})&&n.push({field:e.name,show:"username"===e.name,required:"username"===e.name})}()}catch(e){o=!0,i=e}finally{try{!r&&null!=s.return&&s.return()}finally{if(o)throw i}}return n},[t,e]);return(0,o.useEffect)(function(){var t;e.options=A(F({},e.options),{public:A(F({},null===(t=e.options)||void 0===t?void 0:t.public),{signupForm:u})})},[e,u]),i().createElement(r.SchemaComponent,{components:{ArrayTable:j.ArrayTable},schema:{type:"void",properties:{signupForm:{title:'{{t("Sign up form")}}',type:"array","x-decorator":"FormItem","x-component":"ArrayTable","x-component-props":{bordered:!1},"x-validator":"{{ (value) => {\n const check = value?.some((item) => ['username', 'email'].includes(item.field) && item.show && item.required);\n if (!check) {\n return t('At least one of the username or email fields is required');\n }\n} }}",default:u,items:{type:"object","x-decorator":"ArrayItems.Item",properties:{column0:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:20,align:"center"},properties:{sort:{type:"void","x-component":"ArrayTable.SortHandle"}}},column1:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:100,title:(0,a.KQ)("Field")},properties:{field:{type:"string","x-decorator":"FormItem","x-component":"Select",enum:n,"x-read-pretty":!0}}},column2:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:80,title:(0,a.KQ)("Show")},properties:{show:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:[".required"],fulfill:{state:{value:"{{ $deps[0] || $self.value }}"}}}}}},column3:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:80,title:(0,a.KQ)("Required")},properties:{required:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:[".show"],fulfill:{state:{value:"{{ !$deps[0] ? false : $self.value }}"}}}}}}}}}}}})},C=function(){var e=(0,a.o$)().t;return i().createElement(r.SchemaComponent,{scope:{t:e},components:{Alert:v.Alert,SignupFormSettings:I,FormTab:j.FormTab},schema:{type:"object",properties:{notice:{type:"void","x-decorator":"FormItem","x-component":"Alert","x-component-props":{showIcon:!0,message:'{{t("The authentication allows users to sign in via username or email.")}}'}},public:{type:"object",properties:{collapse:{type:"void","x-component":"FormTab",properties:{basic:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:(0,a.KQ)("Sign up settings")},properties:k({allowSignUp:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Allow to sign up")}}',"x-component":"Checkbox",default:!0}},(0,b.uid)(),{type:"void","x-component":"SignupFormSettings"})}}}}}}}})}}}]);
|
package/dist/client/index.d.ts
CHANGED
|
@@ -37,5 +37,6 @@ export type { Authenticator } from './authenticator';
|
|
|
37
37
|
declare const useSignIn: (name: string) => {
|
|
38
38
|
run(): Promise<void>;
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
declare const useRedirect: (next?: string) => () => void;
|
|
41
|
+
export { useSignIn, useRedirect };
|
|
41
42
|
export default PluginAuthClient;
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react-i18next"),require("react"),require("@emotion/css"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("antd"),require("react-router-dom")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["@nocobase/client","@ant-design/icons","@formily/react","@formily/antd-v5","react-i18next","react","@emotion/css","@formily/shared","@nocobase/utils/client","@formily/core","antd","react-router-dom"],n):"object"==typeof exports?exports["@nocobase/plugin-auth"]=n(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react-i18next"),require("react"),require("@emotion/css"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("antd"),require("react-router-dom")):t["@nocobase/plugin-auth"]=n(t["@nocobase/client"],t["@ant-design/icons"],t["@formily/react"],t["@formily/antd-v5"],t["react-i18next"],t.react,t["@emotion/css"],t["@formily/shared"],t["@nocobase/utils/client"],t["@formily/core"],t.antd,t["react-router-dom"])}(self,function(t,n,e,r,o,i,u,c,a,l,f,s){return function(){var p,d,y,h,v,b,g={851:function(t,n,e){"use strict";e.r(n),e.d(n,{AuthLayout:function(){return C},useSignIn:function(){return q},PluginAuthClient:function(){return R},AuthenticatorsContextProvider:function(){return I},default:function(){return K},AuthenticatorsContext:function(){return f.H},useAuthenticator:function(){return f.u}});var r=e("772"),o=e("584"),i=e("741"),u=e.n(i),c={EMPTY_TOKEN:"EMPTY_TOKEN",EXPIRED_TOKEN:"EXPIRED_TOKEN",INVALID_TOKEN:"INVALID_TOKEN",TOKEN_RENEW_FAILED:"TOKEN_RENEW_FAILED",BLOCKED_TOKEN:"BLOCKED_TOKEN",EXPIRED_SESSION:"EXPIRED_SESSION",NOT_EXIST_USER:"NOT_EXIST_USER",SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW",USER_HAS_NO_ROLES_ERR:"USER_HAS_NO_ROLES_ERR"},a=u()(function(t){t()},3e3,{leading:!0,trailing:!1}),l=e("573"),f=e("308"),s=e(581);function p(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function d(t,n,e,r,o,i,u){try{var c=t[i](u),a=c.value}catch(t){e(t);return}c.done?n(a):Promise.resolve(a).then(r,o)}function y(t,n,e){return(y=m()?Reflect.construct:function(t,n,e){var r=[null];r.push.apply(r,n);var o=new(Function.bind.apply(t,r));return e&&b(o,e.prototype),o}).apply(null,arguments)}function h(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function b(t,n){return(b=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function g(t){var n="function"==typeof Map?new Map:void 0;return(g=function(t){var e;if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return y(t,arguments,v(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),b(r,t)})(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}var _=(0,r.lazy)(function(){return s("imported_gs6osn_component",e.e("890").then(e.bind(e,387)))},"AuthProvider").AuthProvider,E=(0,r.lazy)(function(){return s("imported_kl5khg_component",e.e("938").then(e.bind(e,510)))},"Options","SignInForm","SignUpForm"),S=E.Options,x=E.SignInForm,O=E.SignUpForm,T=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",e.e("280").then(e.bind(e,492)))},"AuthLayout","SignInPage","SignUpPage"),A=T.AuthLayout,P=T.SignInPage,w=T.SignUpPage,j=(0,r.lazy)(function(){return s("imported_10vpsc8_component",e.e("851").then(e.bind(e,264)))},"Authenticator").Authenticator,k=(0,r.lazy)(function(){return s("imported_-1q5gcq5_component",e.e("104").then(e.bind(e,349)))},"TokenPolicySettings").TokenPolicySettings,N=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",e.e("280").then(e.bind(e,492)))},"AuthenticatorsContextProvider","AuthLayout"),I=N.AuthenticatorsContextProvider,C=N.AuthLayout,R=function(t){var n,e,r;function i(){var t,n,e,r,u,c,a;return!function(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,i),n=this,e=i,r=arguments,e=v(e),u=t=function(t,n){return n&&("object"===function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}(n)||"function"==typeof n)?n:function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(n,m()?Reflect.construct(e,r||[],v(n).constructor):e.apply(n,r)),c="authTypes",a=new o.Registry,c in u?Object.defineProperty(u,c,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[c]=a,t}return!function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&b(t,n)}(i,t),n=i,e=[{key:"registerType",value:function(t,n){this.authTypes.register(t,n)}},{key:"load",value:function(){var t,n=this;return(t=function(){var t,e,r;return function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(o){var i,u,f;return n.app.pluginSettingsManager.add(l.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(l.A7,'" })}}'),Component:j,aclSnippet:"pm.auth.authenticators"}),n.router.add("auth",{Component:"AuthLayout"}),n.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),n.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),n.app.addComponents({AuthLayout:A,SignInPage:P,SignUpPage:w}),n.app.providers.unshift([_,{}]),n.registerType("Email/Password",{components:{SignInForm:x,SignUpForm:O,AdminSettingsForm:S}}),n.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(l.A7,'" })}}'),Component:k,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),u=((i=({app:n.app}).app).apiClient.axios,[function(t){var n,e=null==t?void 0:null===(n=t.headers)||void 0===n?void 0:n["x-new-token"];return e&&i.apiClient.auth.setToken(e),t},function(t){var n,e,r,o,u,l=null==t?void 0:null===(e=t.response)||void 0===e?void 0:null===(n=e.headers)||void 0===n?void 0:n["x-new-token"],f=null==t?void 0:null===(o=t.response)||void 0===o?void 0:null===(r=o.data)||void 0===r?void 0:r.errors,s=Array.isArray(f)?f[0]:null,p=i.router.state.location,d=p.pathname,y=p.search,h=i.router.basename;if(l&&i.apiClient.auth.setToken(l),401===t.status&&(null==s?void 0:s.code)&&c[s.code]&&(i.apiClient.auth.setToken(""),d===i.getHref("signin")&&(null==s?void 0:s.code)!==c.EMPTY_TOKEN&&t.config&&(t.config.skipNotify=!1),(null==s?void 0:s.code)==="USER_HAS_NO_ROLES_ERR"&&(t.config.skipNotify=!0,i.error=s)),401===t.status&&!(null===(u=t.config)||void 0===u?void 0:u.skipAuth)&&(null==s?void 0:s.code)&&c[s.code]){if(!s||(null==s?void 0:s.code)===c.SKIP_TOKEN_RENEW)throw t;if(d!==i.getHref("signin")){var v,b,g,m=(v=d,b=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=new RegExp("^".concat(b.replace(/\/?$/,""),"(\\/|$)")),v.replace(g,"/")||v);a(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(m).concat(y),{replace:!0})})}}throw t}]),f=2,e=(t=function(t){if(Array.isArray(t))return t}(u)||function(t,n){var e,r,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],u=!0,c=!1;try{for(o=o.call(t);!(u=(e=o.next()).done)&&(i.push(e.value),!n||i.length!==n);u=!0);}catch(t){c=!0,r=t}finally{try{!u&&null!=o.return&&o.return()}finally{if(c)throw r}}return i}}(u,2)||function(t,n){if(t){if("string"==typeof t)return p(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return p(t,n)}}(u,f)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],r=t[1],n.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:e,rejected:r,synchronous:!1,runWhen:null}),[2]})},function(){var n=this,e=arguments;return new Promise(function(r,o){var i=t.apply(n,e);function u(t){d(i,r,o,u,c,"next",t)}function c(t){d(i,r,o,u,c,"throw",t)}u(void 0)})})()}}],h(n.prototype,e),i}(g(r.Plugin)),q=function(t){return(0,r.useLazy)(function(){return s("imported_kl5khg_component",e.e("938").then(e.bind(e,510)))},"useSignIn")(t)},K=R},308:function(t,n,e){"use strict";e.d(n,{H:function(){return o},u:function(){return i}});var r=e(156),o=(0,r.createContext)([]);o.displayName="AuthenticatorsContext";var i=function(t){return(0,r.useContext)(o).find(function(n){return n.name===t})}},573:function(t,n,e){"use strict";e.d(n,{A7:function(){return i},KQ:function(){return c},o$:function(){return u}});var r=e(238),o=e(772),i="auth";function u(){return(0,r.useTranslation)([i,"client"],{nsMode:"fallback"})}function c(t){return o.i18n.t(t,{ns:[i,"client"],nsMode:"fallback"})}},869:function(t,n,e){var r=e(31).Symbol;t.exports=r},365:function(t,n,e){var r=e(869),o=e(43),i=e(283),u=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?o(t):i(t)}},527:function(t,n,e){var r=e(670),o=/^\s+/;t.exports=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t}},274:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},43:function(t,n,e){var r=e(869),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,c=r?r.toStringTag:void 0;t.exports=function(t){var n=i.call(t,c),e=t[c];try{t[c]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(n?t[c]=e:delete t[c]),o}},283:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},31:function(t,n,e){var r=e(274),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},670:function(t){var n=/\s/;t.exports=function(t){for(var e=t.length;e--&&n.test(t.charAt(e)););return e}},741:function(t,n,e){var r=e(917),o=e(860),i=e(640),u=Math.max,c=Math.min;t.exports=function(t,n,e){var a,l,f,s,p,d,y=0,h=!1,v=!1,b=!0;if("function"!=typeof t)throw TypeError("Expected a function");function g(n){var e=a,r=l;return a=l=void 0,y=n,s=t.apply(r,e)}n=i(n)||0,r(e)&&(h=!!e.leading,f=(v="maxWait"in e)?u(i(e.maxWait)||0,n):f,b="trailing"in e?!!e.trailing:b);function m(t){var e=t-d,r=t-y;return void 0===d||e>=n||e<0||v&&r>=f}function _(){var t,e,r,i,u=o();if(m(u))return E(u);p=setTimeout(_,(e=(t=u)-d,r=t-y,i=n-e,v?c(i,f-r):i))}function E(t){return(p=void 0,b&&a)?g(t):(a=l=void 0,s)}function S(){var t,e=o(),r=m(e);if(a=arguments,l=this,d=e,r){if(void 0===p){;return y=t=d,p=setTimeout(_,n),h?g(t):s}if(v)return clearTimeout(p),p=setTimeout(_,n),g(d)}return void 0===p&&(p=setTimeout(_,n)),s}return S.cancel=function(){void 0!==p&&clearTimeout(p),y=0,a=d=l=p=void 0},S.flush=function(){return void 0===p?s:E(o())},S}},917:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},620:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},528:function(t,n,e){var r=e(365),o=e(620);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},860:function(t,n,e){var r=e(31);t.exports=function(){return r.Date.now()}},640:function(t,n,e){var r=e(527),o=e(917),i=e(528),u=0/0,c=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,f=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return u;if(o(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=o(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=r(t);var e=a.test(t);return e||l.test(t)?f(t.slice(2),e?2:8):c.test(t)?u:+t}},581:function(t){t.exports=function(t,n){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(t,n),n}},482:function(t){"use strict";t.exports=n},964:function(t){"use strict";t.exports=u},632:function(t){"use strict";t.exports=r},563:function(t){"use strict";t.exports=l},505:function(t){"use strict";t.exports=e},875:function(t){"use strict";t.exports=c},772:function(n){"use strict";n.exports=t},584:function(t){"use strict";t.exports=a},721:function(t){"use strict";t.exports=f},156:function(t){"use strict";t.exports=i},238:function(t){"use strict";t.exports=o},128:function(t){"use strict";t.exports=s}},m={};function _(t){var n=m[t];if(void 0!==n)return n.exports;var e=m[t]={exports:{}};return g[t](e,e.exports,_),e.exports}return _.m=g,_.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return _.d(n,{a:n}),n},_.d=function(t,n){for(var e in n)_.o(n,e)&&!_.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},_.f={},_.e=function(t){return Promise.all(Object.keys(_.f).reduce(function(n,e){return _.f[e](t,n),n},[]))},_.u=function(t){return""+({104:"f2122264b5758d8b",280:"9e603524b127e7b4",851:"974ac9de644a1d1f",890:"43e9587ca4936ffe",938:"0091d4359312cb07"})[t]+".js"},_.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),_.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},p={},d="@nocobase/plugin-auth:",_.l=function(t,n,e,r){if(p[t]){p[t].push(n);return}if(void 0!==e){for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==t||a.getAttribute("data-webpack")==d+e){o=a;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,_.nc&&o.setAttribute("nonce",_.nc),o.setAttribute("data-webpack",d+e),o.src=t),p[t]=[n];var l=function(n,e){o.onerror=o.onload=null,clearTimeout(f);var r=p[t];if(delete p[t],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(t){return t(e)}),n)return n(e)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},_.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},_.p=(!(y=window.__nocobase_public_path__||"/").endsWith("/")&&(y+="/"),y+"static/plugins/@nocobase/plugin-auth/dist/client/"),h={909:0},_.f.j=function(t,n){var e=_.o(h,t)?h[t]:void 0;if(0!==e){if(e)n.push(e[2]);else{var r=new Promise(function(n,r){e=h[t]=[n,r]});n.push(e[2]=r);var o=_.p+_.u(t),i=Error();_.l(o,function(n){if(_.o(h,t)&&(0!==(e=h[t])&&(h[t]=void 0),e)){var r=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,e[1](i)}},"chunk-"+t,t)}}},v=function(t,n){var e=n[0],r=n[1],o=n[2],i,u,c=0;if(e.some(function(t){return 0!==h[t]})){for(i in r)_.o(r,i)&&(_.m[i]=r[i]);o&&o(_)}for(t&&t(n);c<e.length;c++)u=e[c],_.o(h,u)&&h[u]&&h[u][0](),h[u]=0},(b=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(v.bind(null,0)),b.push=v.bind(null,b.push.bind(b)),_("851")}()});
|
|
10
|
+
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react-i18next"),require("react"),require("@emotion/css"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("antd"),require("react-router-dom")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["@nocobase/client","@ant-design/icons","@formily/react","@formily/antd-v5","react-i18next","react","@emotion/css","@formily/shared","@nocobase/utils/client","@formily/core","antd","react-router-dom"],n):"object"==typeof exports?exports["@nocobase/plugin-auth"]=n(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react-i18next"),require("react"),require("@emotion/css"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("antd"),require("react-router-dom")):t["@nocobase/plugin-auth"]=n(t["@nocobase/client"],t["@ant-design/icons"],t["@formily/react"],t["@formily/antd-v5"],t["react-i18next"],t.react,t["@emotion/css"],t["@formily/shared"],t["@nocobase/utils/client"],t["@formily/core"],t.antd,t["react-router-dom"])}(self,function(t,n,e,r,o,i,u,c,a,l,f,s){return function(){var p,d,y,h,v,b,g={851:function(t,n,e){"use strict";e.r(n),e.d(n,{PluginAuthClient:function(){return I},AuthenticatorsContextProvider:function(){return R},default:function(){return K},useSignIn:function(){return q},AuthLayout:function(){return C},useRedirect:function(){return L},AuthenticatorsContext:function(){return f.H},useAuthenticator:function(){return f.u}});var r=e("772"),o=e("584"),i=e("741"),u=e.n(i),c={EMPTY_TOKEN:"EMPTY_TOKEN",EXPIRED_TOKEN:"EXPIRED_TOKEN",INVALID_TOKEN:"INVALID_TOKEN",TOKEN_RENEW_FAILED:"TOKEN_RENEW_FAILED",BLOCKED_TOKEN:"BLOCKED_TOKEN",EXPIRED_SESSION:"EXPIRED_SESSION",NOT_EXIST_USER:"NOT_EXIST_USER",SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW",USER_HAS_NO_ROLES_ERR:"USER_HAS_NO_ROLES_ERR"},a=u()(function(t){t()},3e3,{leading:!0,trailing:!1}),l=e("573"),f=e("308"),s=e(581);function p(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function d(t,n,e,r,o,i,u){try{var c=t[i](u),a=c.value}catch(t){e(t);return}c.done?n(a):Promise.resolve(a).then(r,o)}function y(t,n,e){return(y=m()?Reflect.construct:function(t,n,e){var r=[null];r.push.apply(r,n);var o=new(Function.bind.apply(t,r));return e&&b(o,e.prototype),o}).apply(null,arguments)}function h(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function b(t,n){return(b=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function g(t){var n="function"==typeof Map?new Map:void 0;return(g=function(t){var e;if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return y(t,arguments,v(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),b(r,t)})(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}var _=(0,r.lazy)(function(){return s("imported_gs6osn_component",e.e("890").then(e.bind(e,387)))},"AuthProvider").AuthProvider,E=(0,r.lazy)(function(){return s("imported_kl5khg_component",e.e("938").then(e.bind(e,510)))},"Options","SignInForm","SignUpForm"),S=E.Options,x=E.SignInForm,O=E.SignUpForm,T=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",e.e("280").then(e.bind(e,492)))},"AuthLayout","SignInPage","SignUpPage"),A=T.AuthLayout,k=T.SignInPage,P=T.SignUpPage,w=(0,r.lazy)(function(){return s("imported_10vpsc8_component",e.e("851").then(e.bind(e,264)))},"Authenticator").Authenticator,j=(0,r.lazy)(function(){return s("imported_-1q5gcq5_component",e.e("104").then(e.bind(e,349)))},"TokenPolicySettings").TokenPolicySettings,N=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",e.e("280").then(e.bind(e,492)))},"AuthenticatorsContextProvider","AuthLayout"),R=N.AuthenticatorsContextProvider,C=N.AuthLayout,I=function(t){var n,e,r;function i(){var t,n,e,r,u,c,a;return!function(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,i),n=this,e=i,r=arguments,e=v(e),u=t=function(t,n){return n&&("object"===function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}(n)||"function"==typeof n)?n:function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(n,m()?Reflect.construct(e,r||[],v(n).constructor):e.apply(n,r)),c="authTypes",a=new o.Registry,c in u?Object.defineProperty(u,c,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[c]=a,t}return!function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&b(t,n)}(i,t),n=i,e=[{key:"registerType",value:function(t,n){this.authTypes.register(t,n)}},{key:"load",value:function(){var t,n=this;return(t=function(){var t,e,r;return function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(o){var i,u,f;return n.app.pluginSettingsManager.add(l.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(l.A7,'" })}}'),aclSnippet:"pm.auth"}),n.app.pluginSettingsManager.add("auth.authenticators",{icon:"LoginOutlined",title:'{{t("Authenticators", { ns: "'.concat(l.A7,'" })}}'),Component:w,aclSnippet:"pm.auth.authenticators",sort:1}),n.router.add("auth",{Component:"AuthLayout"}),n.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),n.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),n.app.addComponents({AuthLayout:A,SignInPage:k,SignUpPage:P}),n.app.providers.unshift([_,{}]),n.registerType("Email/Password",{components:{SignInForm:x,SignUpForm:O,AdminSettingsForm:S}}),n.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(l.A7,'" })}}'),Component:j,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),u=((i=({app:n.app}).app).apiClient.axios,[function(t){var n,e=null==t?void 0:null===(n=t.headers)||void 0===n?void 0:n["x-new-token"];return e&&i.apiClient.auth.setToken(e),t},function(t){var n,e,r,o,u,l=null==t?void 0:null===(e=t.response)||void 0===e?void 0:null===(n=e.headers)||void 0===n?void 0:n["x-new-token"],f=null==t?void 0:null===(o=t.response)||void 0===o?void 0:null===(r=o.data)||void 0===r?void 0:r.errors,s=Array.isArray(f)?f[0]:null,p=i.router.state.location,d=p.pathname,y=p.search,h=i.router.basename;if(l&&i.apiClient.auth.setToken(l),401===t.status&&(null==s?void 0:s.code)&&c[s.code]&&(i.apiClient.auth.setToken(""),d===i.getHref("signin")&&(null==s?void 0:s.code)!==c.EMPTY_TOKEN&&t.config&&(t.config.skipNotify=!1),(null==s?void 0:s.code)==="USER_HAS_NO_ROLES_ERR"&&(t.config.skipNotify=!0,i.error=s)),401===t.status&&!(null===(u=t.config)||void 0===u?void 0:u.skipAuth)&&(null==s?void 0:s.code)&&c[s.code]){if(!s||(null==s?void 0:s.code)===c.SKIP_TOKEN_RENEW)throw t;var v=i.router.isSkippedAuthCheckRoute(d);if(v&&(t.config.skipNotify=!0),d!==i.getHref("signin")&&!v){var b,g,m,_=(b=d,g=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),m=new RegExp("^".concat(g.replace(/\/?$/,""),"(\\/|$)")),b.replace(m,"/")||b);a(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(_).concat(y),{replace:!0})})}}throw t}]),f=2,e=(t=function(t){if(Array.isArray(t))return t}(u)||function(t,n){var e,r,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],u=!0,c=!1;try{for(o=o.call(t);!(u=(e=o.next()).done)&&(i.push(e.value),!n||i.length!==n);u=!0);}catch(t){c=!0,r=t}finally{try{!u&&null!=o.return&&o.return()}finally{if(c)throw r}}return i}}(u,2)||function(t,n){if(t){if("string"==typeof t)return p(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return p(t,n)}}(u,f)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],r=t[1],n.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:e,rejected:r,synchronous:!1,runWhen:null}),[2]})},function(){var n=this,e=arguments;return new Promise(function(r,o){var i=t.apply(n,e);function u(t){d(i,r,o,u,c,"next",t)}function c(t){d(i,r,o,u,c,"throw",t)}u(void 0)})})()}}],h(n.prototype,e),i}(g(r.Plugin)),q=function(t){return(0,r.useLazy)(function(){return s("imported_kl5khg_component",e.e("938").then(e.bind(e,510)))},"useSignIn")(t)},L=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/admin";return(0,r.useLazy)(function(){return s("imported_kl5khg_component",e.e("938").then(e.bind(e,510)))},"useRedirect")(t)},K=I},308:function(t,n,e){"use strict";e.d(n,{H:function(){return o},u:function(){return i}});var r=e(156),o=(0,r.createContext)([]);o.displayName="AuthenticatorsContext";var i=function(t){return(0,r.useContext)(o).find(function(n){return n.name===t})}},573:function(t,n,e){"use strict";e.d(n,{A7:function(){return i},KQ:function(){return c},o$:function(){return u}});var r=e(238),o=e(772),i="auth";function u(){return(0,r.useTranslation)([i,"client"],{nsMode:"fallback"})}function c(t){return o.i18n.t(t,{ns:[i,"client"],nsMode:"fallback"})}},869:function(t,n,e){var r=e(31).Symbol;t.exports=r},365:function(t,n,e){var r=e(869),o=e(43),i=e(283),u=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?o(t):i(t)}},527:function(t,n,e){var r=e(670),o=/^\s+/;t.exports=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t}},274:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},43:function(t,n,e){var r=e(869),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,c=r?r.toStringTag:void 0;t.exports=function(t){var n=i.call(t,c),e=t[c];try{t[c]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(n?t[c]=e:delete t[c]),o}},283:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},31:function(t,n,e){var r=e(274),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},670:function(t){var n=/\s/;t.exports=function(t){for(var e=t.length;e--&&n.test(t.charAt(e)););return e}},741:function(t,n,e){var r=e(917),o=e(860),i=e(640),u=Math.max,c=Math.min;t.exports=function(t,n,e){var a,l,f,s,p,d,y=0,h=!1,v=!1,b=!0;if("function"!=typeof t)throw TypeError("Expected a function");function g(n){var e=a,r=l;return a=l=void 0,y=n,s=t.apply(r,e)}n=i(n)||0,r(e)&&(h=!!e.leading,f=(v="maxWait"in e)?u(i(e.maxWait)||0,n):f,b="trailing"in e?!!e.trailing:b);function m(t){var e=t-d,r=t-y;return void 0===d||e>=n||e<0||v&&r>=f}function _(){var t,e,r,i,u=o();if(m(u))return E(u);p=setTimeout(_,(e=(t=u)-d,r=t-y,i=n-e,v?c(i,f-r):i))}function E(t){return(p=void 0,b&&a)?g(t):(a=l=void 0,s)}function S(){var t,e=o(),r=m(e);if(a=arguments,l=this,d=e,r){if(void 0===p){;return y=t=d,p=setTimeout(_,n),h?g(t):s}if(v)return clearTimeout(p),p=setTimeout(_,n),g(d)}return void 0===p&&(p=setTimeout(_,n)),s}return S.cancel=function(){void 0!==p&&clearTimeout(p),y=0,a=d=l=p=void 0},S.flush=function(){return void 0===p?s:E(o())},S}},917:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},620:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},528:function(t,n,e){var r=e(365),o=e(620);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},860:function(t,n,e){var r=e(31);t.exports=function(){return r.Date.now()}},640:function(t,n,e){var r=e(527),o=e(917),i=e(528),u=0/0,c=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,f=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return u;if(o(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=o(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=r(t);var e=a.test(t);return e||l.test(t)?f(t.slice(2),e?2:8):c.test(t)?u:+t}},581:function(t){t.exports=function(t,n){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(t,n),n}},482:function(t){"use strict";t.exports=n},964:function(t){"use strict";t.exports=u},632:function(t){"use strict";t.exports=r},563:function(t){"use strict";t.exports=l},505:function(t){"use strict";t.exports=e},875:function(t){"use strict";t.exports=c},772:function(n){"use strict";n.exports=t},584:function(t){"use strict";t.exports=a},721:function(t){"use strict";t.exports=f},156:function(t){"use strict";t.exports=i},238:function(t){"use strict";t.exports=o},128:function(t){"use strict";t.exports=s}},m={};function _(t){var n=m[t];if(void 0!==n)return n.exports;var e=m[t]={exports:{}};return g[t](e,e.exports,_),e.exports}return _.m=g,_.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return _.d(n,{a:n}),n},_.d=function(t,n){for(var e in n)_.o(n,e)&&!_.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},_.f={},_.e=function(t){return Promise.all(Object.keys(_.f).reduce(function(n,e){return _.f[e](t,n),n},[]))},_.u=function(t){return""+({104:"f2122264b5758d8b",280:"9e603524b127e7b4",851:"2fde58876f8f8762",890:"43e9587ca4936ffe",938:"49850b42bb3c17b7"})[t]+".js"},_.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),_.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},p={},d="@nocobase/plugin-auth:",_.l=function(t,n,e,r){if(p[t]){p[t].push(n);return}if(void 0!==e){for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==t||a.getAttribute("data-webpack")==d+e){o=a;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,_.nc&&o.setAttribute("nonce",_.nc),o.setAttribute("data-webpack",d+e),o.src=t),p[t]=[n];var l=function(n,e){o.onerror=o.onload=null,clearTimeout(f);var r=p[t];if(delete p[t],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(t){return t(e)}),n)return n(e)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},_.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},_.p=(!(y=window.__nocobase_public_path__||"/").endsWith("/")&&(y+="/"),y+"static/plugins/@nocobase/plugin-auth/dist/client/"),h={909:0},_.f.j=function(t,n){var e=_.o(h,t)?h[t]:void 0;if(0!==e){if(e)n.push(e[2]);else{var r=new Promise(function(n,r){e=h[t]=[n,r]});n.push(e[2]=r);var o=_.p+_.u(t),i=Error();_.l(o,function(n){if(_.o(h,t)&&(0!==(e=h[t])&&(h[t]=void 0),e)){var r=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,e[1](i)}},"chunk-"+t,t)}}},v=function(t,n){var e=n[0],r=n[1],o=n[2],i,u,c=0;if(e.some(function(t){return 0!==h[t]})){for(i in r)_.o(r,i)&&(_.m[i]=r[i]);o&&o(_)}for(t&&t(n);c<e.length;c++)u=e[c],_.o(h,u)&&h[u]&&h[u][0](),h[u]=0},(b=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(v.bind(null,0)),b.push=v.bind(null,b.push.bind(b)),_("851")}()});
|
|
@@ -7,4 +7,10 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
+
export declare const useCreateAction: () => {
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export declare const useUpdateAction: () => {
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
};
|
|
10
16
|
export declare const Authenticator: () => React.JSX.Element;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,25 +8,25 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.7.0-beta.
|
|
11
|
+
"@nocobase/client": "1.7.0-beta.11",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/utils": "1.7.0-beta.
|
|
13
|
+
"@nocobase/utils": "1.7.0-beta.11",
|
|
14
14
|
"axios": "1.7.7",
|
|
15
15
|
"lodash": "4.17.21",
|
|
16
|
-
"@nocobase/auth": "1.7.0-beta.
|
|
17
|
-
"@nocobase/database": "1.7.0-beta.
|
|
18
|
-
"@nocobase/cache": "1.7.0-beta.
|
|
19
|
-
"@nocobase/server": "1.7.0-beta.
|
|
20
|
-
"@nocobase/logger": "1.7.0-beta.
|
|
21
|
-
"@nocobase/test": "1.7.0-beta.
|
|
22
|
-
"@formily/antd-v5": "1.
|
|
23
|
-
"antd": "5.
|
|
16
|
+
"@nocobase/auth": "1.7.0-beta.11",
|
|
17
|
+
"@nocobase/database": "1.7.0-beta.11",
|
|
18
|
+
"@nocobase/cache": "1.7.0-beta.11",
|
|
19
|
+
"@nocobase/server": "1.7.0-beta.11",
|
|
20
|
+
"@nocobase/logger": "1.7.0-beta.11",
|
|
21
|
+
"@nocobase/test": "1.7.0-beta.11",
|
|
22
|
+
"@formily/antd-v5": "1.2.3",
|
|
23
|
+
"antd": "5.24.2",
|
|
24
24
|
"@formily/shared": "2.3.2",
|
|
25
25
|
"@formily/react": "2.3.0",
|
|
26
26
|
"react-router-dom": "6.28.1",
|
|
27
27
|
"react-i18next": "11.18.6",
|
|
28
28
|
"@emotion/css": "11.13.0",
|
|
29
29
|
"@ant-design/icons": "5.6.1",
|
|
30
|
-
"@nocobase/actions": "1.7.0-beta.
|
|
30
|
+
"@nocobase/actions": "1.7.0-beta.11",
|
|
31
31
|
"@formily/core": "2.3.0"
|
|
32
32
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Auth Type": "Authentifizierungstyp",
|
|
3
|
+
"Authenticators": "Authentifikatoren",
|
|
4
|
+
"Authentication": "Authentifizierung",
|
|
5
|
+
"Sign in via email": "Mit E-Mail anmelden",
|
|
6
|
+
"Sign in via password": "Mit Passwort anmelden",
|
|
7
|
+
"Not allowed to sign up": "Registrierung nicht erlaubt",
|
|
8
|
+
"Allow to sign up": "Registrierung erlauben",
|
|
9
|
+
"The username or email is incorrect, please re-enter": "Der Benutzername oder die E-Mail ist falsch, bitte erneut eingeben",
|
|
10
|
+
"The password is incorrect, please re-enter": "Das Passwort ist falsch, bitte erneut eingeben",
|
|
11
|
+
"Not a valid cellphone number, please re-enter": "Keine gültige Handynummer, bitte erneut eingeben",
|
|
12
|
+
"The phone number has been registered, please login directly": "Die Telefonnummer wurde bereits registriert, bitte direkt anmelden",
|
|
13
|
+
"The phone number is not registered, please register first": "Die Telefonnummer ist nicht registriert, bitte zuerst registrieren",
|
|
14
|
+
"Please keep and enable at least one authenticator": "Bitte mindestens einen Authentifikator beibehalten und aktivieren",
|
|
15
|
+
"Allow to sign in with": "Anmeldung erlauben mit",
|
|
16
|
+
"Please enter a valid username": "Bitte geben Sie einen gültigen Benutzernamen ein",
|
|
17
|
+
"Please enter a valid email": "Bitte geben Sie eine gültige E-Mail-Adresse ein",
|
|
18
|
+
"Please enter your username or email": "Bitte geben Sie Ihren Benutzernamen oder Ihre E-Mail-Adresse ein",
|
|
19
|
+
"Please enter a password": "Bitte geben Sie ein Passwort ein",
|
|
20
|
+
"Username/Email": "Benutzername/E-Mail",
|
|
21
|
+
"Auth UID": "Auth-UID",
|
|
22
|
+
"The authentication allows users to sign in via username or email.": "Die Authentifizierung ermöglicht Benutzern die Anmeldung über Benutzernamen oder E-Mail.",
|
|
23
|
+
"No authentication methods available.": "Keine Authentifizierungsmethoden verfügbar.",
|
|
24
|
+
"The password is inconsistent, please re-enter": "Das Passwort ist inkonsistent, bitte erneut eingeben",
|
|
25
|
+
"Sign-in": "Anmelden",
|
|
26
|
+
"Password": "Passwort",
|
|
27
|
+
"The username/email or password is incorrect, please re-enter": "Der Benutzername/die E-Mail oder das Passwort ist falsch, bitte erneut eingeben",
|
|
28
|
+
"Show": "Anzeigen",
|
|
29
|
+
"Sign up settings": "Registrierungseinstellungen",
|
|
30
|
+
"Sign up form": "Registrierungsformular",
|
|
31
|
+
"At least one of the username or email fields is required": "Mindestens eines der Felder Benutzername oder E-Mail ist erforderlich",
|
|
32
|
+
"Password is not allowed to be changed": "Das Passwort darf nicht geändert werden",
|
|
33
|
+
"Token policy": "Token-Richtlinie",
|
|
34
|
+
"Token validity period": "Token-Gültigkeitsdauer",
|
|
35
|
+
"Session validity period": "Sitzungsgültigkeitsdauer",
|
|
36
|
+
"Expired token refresh limit": "Limit für die Aktualisierung abgelaufener Token",
|
|
37
|
+
"Token validity period must be less than session validity period!": "Die Token-Gültigkeitsdauer muss kürzer sein als die Sitzungsgültigkeitsdauer!",
|
|
38
|
+
"Seconds": "Sekunden",
|
|
39
|
+
"Minutes": "Minuten",
|
|
40
|
+
"Hours": "Stunden",
|
|
41
|
+
"Days": "Tage",
|
|
42
|
+
"Saved successfully!": "Erfolgreich gespeichert!",
|
|
43
|
+
"The maximum valid time for each user login. During the session validity, the Token will be automatically updated. After the timeout, the user is required to log in again.": "Die maximale Gültigkeitsdauer für jede Benutzeranmeldung. Während der Sitzungsgültigkeit wird das Token automatisch aktualisiert. Nach dem Timeout muss sich der Benutzer erneut anmelden.",
|
|
44
|
+
"The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)": "Die Gültigkeitsdauer jedes ausgestellten API-Tokens. Nachdem das Token abgelaufen ist, wird der Server automatisch ein neues Token ausstellen, um die Benutzersitzung aufrechtzuerhalten, wenn es innerhalb der Sitzungsgültigkeitsdauer liegt und das Aktualisierungslimit nicht überschritten hat, andernfalls muss sich der Benutzer erneut anmelden. (Jedes Token kann nur einmal aktualisiert werden)",
|
|
45
|
+
"The maximum time limit allowed for refreshing a Token after it expires. After this time limit, the token cannot be automatically renewed, and the user needs to log in again.": "Die maximal zulässige Zeitbegrenzung für die Aktualisierung eines Tokens nach dessen Ablauf. Nach dieser Zeitbegrenzung kann das Token nicht automatisch erneuert werden, und der Benutzer muss sich erneut anmelden.",
|
|
46
|
+
"In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "Im Konfigurationsmodus wird die gesamte Spalte transparent. Im Nicht-Konfigurationsmodus wird die gesamte Spalte ausgeblendet. Auch wenn die gesamte Spalte ausgeblendet ist, bleiben ihre konfigurierten Standardwerte und andere Einstellungen weiterhin wirksam.",
|
|
47
|
+
"Your session has expired. Please sign in again.": "Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an.",
|
|
48
|
+
"Unauthenticated. Please sign in to continue.": "Nicht authentifiziert. Bitte melden Sie sich an, um fortzufahren.",
|
|
49
|
+
"User not found. Please sign in again to continue.": "Benutzer nicht gefunden. Bitte melden Sie sich erneut an, um fortzufahren."
|
|
50
|
+
}
|
package/dist/locale/it-IT.json
CHANGED
|
@@ -29,5 +29,27 @@
|
|
|
29
29
|
"Sign up settings": "Impostazioni di registrazione",
|
|
30
30
|
"Sign up form": "Modulo di registrazione",
|
|
31
31
|
"At least one of the username or email fields is required": "È richiesto almeno uno dei campi nome utente o email",
|
|
32
|
-
"Password is not allowed to be changed": "Non consentire cambio password"
|
|
32
|
+
"Password is not allowed to be changed": "Non consentire cambio password",
|
|
33
|
+
"Token policy": "Politica token",
|
|
34
|
+
"Token validity period": "Periodo di validità del token",
|
|
35
|
+
"Session validity period": "Periodo di validità della sessione",
|
|
36
|
+
"Expired token refresh limit": "Limite di aggiornamento token scaduto",
|
|
37
|
+
"Token validity period must be less than session validity period!": "Il periodo di validità del token deve essere inferiore al periodo di validità della sessione!",
|
|
38
|
+
"Seconds": "Secondi",
|
|
39
|
+
"Minutes": "Minuti",
|
|
40
|
+
"Hours": "Ore",
|
|
41
|
+
"Days": "Giorni",
|
|
42
|
+
"Saved successfully!": "Salvato con successo!",
|
|
43
|
+
"The maximum valid time for each user login. During the session validity, the Token will be automatically updated. After the timeout, the user is required to log in again.": "Il tempo massimo valido per ogni accesso utente. Durante la validità della sessione, il token verrà aggiornato automaticamente. Dopo il timeout, all'utente verrà richiesto di accedere nuovamente.",
|
|
44
|
+
"The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)": "Il periodo di validità di ciascun token API emesso. Dopo la scadenza del token, se rientra nel periodo di validità della sessione e il limite di tempo di aggiornamento non è stato superato, il server emetterà automaticamente un nuovo token per mantenere la sessione utente, altrimenti all'utente verrà richiesto di accedere nuovamente. (Ogni token può essere aggiornato una sola volta)",
|
|
45
|
+
"The maximum time limit allowed for refreshing a Token after it expires. After this time limit, the token cannot be automatically renewed, and the user needs to log in again.": "Il limite di tempo massimo consentito per l'aggiornamento del token dopo la scadenza. Superato questo limite di tempo, il token non può essere rinnovato automaticamente e l'utente dovrà effettuare nuovamente l'accesso.",
|
|
46
|
+
"Your session has expired. Please sign in again.": "La tua sessione è scaduta. Accedi di nuovo.",
|
|
47
|
+
"Unauthenticated. Please sign in to continue.": "Non autenticato. Accedi per continuare.",
|
|
48
|
+
"User not found. Please sign in again to continue.": "Utente non trovato. Accedi di nuovo per continuare.",
|
|
49
|
+
"Select Import data": "Seleziona dati da importare",
|
|
50
|
+
"Select Import Plugins": "Seleziona plugin di importazione",
|
|
51
|
+
"Select User Collections": "Seleziona raccolte utente",
|
|
52
|
+
"Basic Data": "Dati di base",
|
|
53
|
+
"Optional Data": "Dati opzionali",
|
|
54
|
+
"User Data": "Dati utente"
|
|
33
55
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Auth Type": "Authenticatietype",
|
|
3
|
+
"Authenticators": "Authenticators",
|
|
4
|
+
"Authentication": "Authenticatie",
|
|
5
|
+
"Sign in via email": "Inloggen via e-mail",
|
|
6
|
+
"Sign in via password": "Inloggen via wachtwoord",
|
|
7
|
+
"Not allowed to sign up": "Aanmelden is niet toegestaan",
|
|
8
|
+
"Allow to sign up": "Toestaan om je aan te melden",
|
|
9
|
+
"The username or email is incorrect, please re-enter": "De gebruikersnaam of e-mail is incorrect, probeer het opnieuw",
|
|
10
|
+
"The password is incorrect, please re-enter": "Het wachtwoord is incorrect, probeer het opnieuw",
|
|
11
|
+
"Not a valid cellphone number, please re-enter": "Geen geldig telefoonnummer, probeer opnieuw in te voeren",
|
|
12
|
+
"The phone number has been registered, please login directly": "Het telefoonnummer is al geregistreerd, log direct in",
|
|
13
|
+
"The phone number is not registered, please register first": "Het telefoonnummer is niet geregistreerd, registreer eerst",
|
|
14
|
+
"Please keep and enable at least one authenticator": "Houd minstens één authenticator ingeschakeld",
|
|
15
|
+
"Allow to sign in with": "Toestaan om in te loggen met",
|
|
16
|
+
"Please enter a valid username": "Voer een geldige gebruikersnaam in",
|
|
17
|
+
"Please enter a valid email": "Voer een geldig e-mailadres in",
|
|
18
|
+
"Please enter your username or email": "Voer je gebruikersnaam of e-mailadres in",
|
|
19
|
+
"Please enter a password": "Voer een wachtwoord in",
|
|
20
|
+
"Username/Email": "Gebruikersnaam/E-mail",
|
|
21
|
+
"Auth UID": "Auth UID",
|
|
22
|
+
"The authentication allows users to sign in via username or email.": "De authenticatie staat gebruikers toe in te loggen via gebruikersnaam of e-mail.",
|
|
23
|
+
"No authentication methods available.": "Geen authenticatiemethoden beschikbaar.",
|
|
24
|
+
"The password is inconsistent, please re-enter": "Het wachtwoord is inconsistent, probeer het opnieuw",
|
|
25
|
+
"Sign-in": "Inloggen",
|
|
26
|
+
"Password": "Wachtwoord",
|
|
27
|
+
"The username/email or password is incorrect, please re-enter": "De gebruikersnaam/e-mail of het wachtwoord is incorrect, probeer het opnieuw",
|
|
28
|
+
"Show": "Toon",
|
|
29
|
+
"Sign up settings": "Aanmeldinstellingen",
|
|
30
|
+
"Sign up form": "Aanmeldformulier",
|
|
31
|
+
"At least one of the username or email fields is required": "Ten minste één van de velden voor gebruikersnaam of e-mail is verplicht",
|
|
32
|
+
"Password is not allowed to be changed": "Wachtwoord mag niet worden gewijzigd"
|
|
33
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2025-03-
|
|
1
|
+
{"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2025-03-27T10:28:18.509Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2025-03-
|
|
1
|
+
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2025-03-27T10:28:18.591Z"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"The email is incorrect, please re-enter": "Het e-mailadres is onjuist, voer deze opnieuw in",
|
|
3
|
+
"Please fill in your email address": "Vul je e-mailadres in",
|
|
4
|
+
"The password is incorrect, please re-enter": "Het wachtwoord is onjuist, voer het opnieuw in",
|
|
5
|
+
"Not a valid cellphone number, please re-enter": "Geen geldig mobiel nummer, voer het opnieuw in",
|
|
6
|
+
"The phone number has been registered, please login directly": "Het telefoonnummer is geregistreerd, log direct in",
|
|
7
|
+
"The phone number is not registered, please register first": "Dit telefoonnummer is niet geregistreerd, registreer het eerst"
|
|
8
|
+
}
|
package/dist/server/plugin.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(plugin_exports, {
|
|
|
42
42
|
module.exports = __toCommonJS(plugin_exports);
|
|
43
43
|
var import_server = require("@nocobase/server");
|
|
44
44
|
var import_utils = require("@nocobase/utils");
|
|
45
|
+
var import_constants = require("../constants");
|
|
45
46
|
var import_preset = require("../preset");
|
|
46
47
|
var import_auth = __toESM(require("./actions/auth"));
|
|
47
48
|
var import_authenticators = __toESM(require("./actions/authenticators"));
|
|
@@ -50,7 +51,6 @@ var import_authenticator = require("./model/authenticator");
|
|
|
50
51
|
var import_storer = require("./storer");
|
|
51
52
|
var import_token_blacklist = require("./token-blacklist");
|
|
52
53
|
var import_token_controller = require("./token-controller");
|
|
53
|
-
var import_constants = require("../constants");
|
|
54
54
|
class PluginAuthServer extends import_server.Plugin {
|
|
55
55
|
cache;
|
|
56
56
|
afterAdd() {
|
|
@@ -152,14 +152,14 @@ class PluginAuthServer extends import_server.Plugin {
|
|
|
152
152
|
await this.cache.del(`auth:${userId}`);
|
|
153
153
|
});
|
|
154
154
|
this.app.on("ws:message:auth:token", async ({ clientId, payload }) => {
|
|
155
|
-
if (!payload || !payload.token
|
|
155
|
+
if (!payload || !payload.token) {
|
|
156
156
|
this.app.emit(`ws:removeTag`, {
|
|
157
157
|
clientId,
|
|
158
158
|
tagKey: "userId"
|
|
159
159
|
});
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
const auth = await this.app.authManager.get(payload.authenticator, {
|
|
162
|
+
const auth = await this.app.authManager.get(payload.authenticator || "basic", {
|
|
163
163
|
getBearerToken: () => payload.token,
|
|
164
164
|
app: this.app,
|
|
165
165
|
db: this.app.db,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-auth",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.11",
|
|
4
4
|
"main": "./dist/server/index.js",
|
|
5
5
|
"homepage": "https://docs.nocobase.com/handbook/auth",
|
|
6
6
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"displayName.zh-CN": "用户认证",
|
|
28
28
|
"description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
|
|
29
29
|
"description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "a5227915c2ef65501965dbff8be0e0f51039296e",
|
|
31
31
|
"keywords": [
|
|
32
32
|
"Authentication",
|
|
33
33
|
"Security"
|
|
@@ -1,10 +0,0 @@
|
|
|
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_auth=self.webpackChunk_nocobase_plugin_auth||[]).push([["851"],{264:function(e,t,o){o.r(t),o.d(t,{Authenticator:function(){return T}});var n=o("772"),r=o("721"),i=o("156"),c=o.n(i),a=o("875"),p=o("238"),l=(0,i.createContext)({type:""});l.displayName="AuthTypeContext";var u=(0,i.createContext)({types:[]});u.displayName="AuthTypesContext";function s(e,t,o,n,r,i,c){try{var a=e[i](c),p=a.value}catch(e){o(e);return}a.done?t(p):Promise.resolve(p).then(n,r)}var m={name:"authenticators",sortable:!0,fields:[{name:"id",type:"string",interface:"id"},{interface:"input",type:"string",name:"name",uiSchema:{type:"string",title:'{{t("Auth UID")}}',"x-component":"Input","x-validator":function(e){return/^[a-zA-Z0-9_-]+$/.test(e)?"":n.i18n.t("a-z, A-Z, 0-9, _, -")},required:!0}},{interface:"input",type:"string",name:"authType",uiSchema:{type:"string",title:'{{t("Auth Type")}}',"x-component":"Select",dataSource:"{{ types }}",required:!0}},{interface:"input",type:"string",name:"title",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"textarea",type:"string",name:"description",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input"}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},y={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:function(e){var t,o,r=(0,n.useActionContext)(),c=(0,i.useContext)(l).type;return(0,n.useRequest)(function(){return Promise.resolve({data:{name:"s_".concat((0,a.uid)()),authType:c}})},(t=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){var n,r,i;n=e,r=t,i=o[t],r in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i})}return e}({},e),o=(o={refreshDeps:[r.visible]},o),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o.push.apply(o,n)}return o})(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}),t))}},title:'{{t("Add new")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}},d={type:"void",name:"authenticators","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:m,resourceName:"authenticators",dragSort:!0,request:{resource:"authenticators",action:"list",params:{pageSize:50,sort:"sort",appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:m},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"AddNew","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction:function(){var e=(0,n.useAPIClient)(),t=(0,p.useTranslation)().t;return{move:function(o,n){var i;return(i=function(){return function(e,t){var o,n,r,i,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(o)throw TypeError("Generator is already executing.");for(;c;)try{if(o=1,n&&(r=2&i[0]?n.return:i[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,i[1])).done)return r;switch(n=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,n=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){c=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){c.label=i[1];break}if(6===i[0]&&c.label<r[1]){c.label=r[1],r=i;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(i);break}r[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],n=0}finally{o=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(i){switch(i.label){case 0:return[4,e.resource("authenticators").move({sourceId:o.id,targetId:n.id})];case 1:return i.sent(),r.message.success(t("Saved successfully"),.2),[2]}})},function(){var e=this,t=arguments;return new Promise(function(o,n){var r=i.apply(e,t);function c(e){s(r,o,n,c,a,"next",e)}function a(e){s(r,o,n,c,a,"throw",e)}c(void 0)})})()}}}},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0,enum:"{{ types }}"}}},title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Configure")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"},"x-disabled":"{{ useCanNotDelete() }}"}}}}}}}}},f=o("482"),b=o("505"),x=o("851");function v(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){var n,r,i;n=e,r=t,i=o[t],r in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i})}return e}var h=function(e){var t,o,r=(0,n.useRecord)();var c=(0,n.useRequest)(function(){return Promise.resolve({data:v({},r.options)})},(t=v({},e),o=(o={manual:!0},o),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o.push.apply(o,n)}return o})(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}),t)),a=c.run,p=(0,n.useActionContext)();return(0,i.useEffect)(function(){p.visible&&a()},[p.visible,a]),c},O=function(e){var t,o=(0,n.usePlugin)(x.default).authTypes.get(e);return null==o?void 0:null===(t=o.components)||void 0===t?void 0:t.AdminSettingsForm},g=(0,b.observer)(function(){var e=(0,b.useForm)(),t=(0,n.useRecord)(),o=O(e.values.authType||t.authType);return o?c().createElement(o,null):null},{displayName:"Options"}),w=o("573");function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o<t;o++)n[o]=e[o];return n}function A(e,t,o,n,r,i,c){try{var a=e[i](c),p=a.value}catch(e){o(e);return}a.done?t(p):Promise.resolve(p).then(n,r)}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o,n,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],c=!0,a=!1;try{for(r=r.call(e);!(c=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);c=!0);}catch(e){a=!0,n=e}finally{try{!c&&null!=r.return&&r.return()}finally{if(a)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return C(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.")}()}var P=function(){var e=(0,n.useActionContext)().setVisible;return{run:function(){var t;return(t=function(){return function(e,t){var o,n,r,i,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(o)throw TypeError("Generator is already executing.");for(;c;)try{if(o=1,n&&(r=2&i[0]?n.return:i[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,i[1])).done)return r;switch(n=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,n=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){c=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){c.label=i[1];break}if(6===i[0]&&c.label<r[1]){c.label=r[1],r=i;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(i);break}r[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],n=0}finally{o=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(t){return e(!1),[2]})},function(){var e=this,o=arguments;return new Promise(function(n,r){var i=t.apply(e,o);function c(e){A(i,n,r,c,a,"next",e)}function a(e){A(i,n,r,c,a,"throw",e)}c(void 0)})})()}}},S=function(){var e=(0,p.useTranslation)().t,t=j((0,i.useState)(!1),2),o=t[0],a=t[1],s=j((0,i.useState)(""),2),m=s[0],d=s[1],b=(0,i.useContext)(u).types,x=b.map(function(e){var t,o;return t=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){var n,r,i;n=e,r=t,i=o[t],r in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i})}return e}({},e),o=(o={onClick:function(){a(!0),d(e.value)}},o),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o.push.apply(o,n)}return o})(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}),t});return c().createElement(n.ActionContextProvider,{value:{visible:o,setVisible:a}},c().createElement(l.Provider,{value:{type:m}},c().createElement(r.Dropdown,{menu:{items:x}},c().createElement(r.Button,{icon:c().createElement(f.PlusOutlined,null),type:"primary"},e("Add new")," ",c().createElement(f.DownOutlined,null))),c().createElement(n.SchemaComponent,{scope:{useCloseAction:P,types:b,setType:d},schema:y})))},D=function(){return(0,n.useAsyncData)().data,!1},T=function(){var e=(0,w.o$)().t,t=j((0,i.useState)([]),2),o=t[0],a=t[1],p=(0,n.useAPIClient)();return(0,n.useRequest)(function(){return p.resource("authenticators").listTypes().then(function(t){var o;return((null==t?void 0:null===(o=t.data)||void 0===o?void 0:o.data)||[]).map(function(t){return{key:t.name,label:b.Schema.compile(t.title||t.name,{t:e}),value:t.name}})})},{onSuccess:function(e){a(e)}}),c().createElement(r.Card,{bordered:!1},c().createElement(u.Provider,{value:{types:o}},c().createElement(n.SchemaComponent,{schema:d,components:{AddNew:S,Options:g},scope:{types:o,useValuesFromOptions:h,useCanNotDelete:D,t:e}})))}}}]);
|