@nocobase/plugin-auth 1.7.0-beta.26 → 1.7.0-beta.28

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.
@@ -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},useUpdateAction:function(){return _},useCreateAction:function(){return R}});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:[]});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)}l.displayName="AuthTypesContext";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"}}]},y={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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},e),n=n={refreshDeps:[r.visible]},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 }}"}}}}}}}},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,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){var u=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,o=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){c=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){c.label=u[1];break}if(6===u[0]&&c.label<r[1]){c.label=r[1],r=u;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(u);break}r[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(e,c)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(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","x-disabled":!0},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),x=n(851);function v(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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}var h=function(e){var t,n,r=(0,o.useRecord)(),c=(0,o.useRequest)(function(){return Promise.resolve({data:v({},r.options)})},(t=v({},e),n=n={manual:!0},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)(x.default).authTypes.get(e);return null==n||null==(t=n.components)?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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}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){var u=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,o=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){c=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){c.label=u[1];break}if(6===u[0]&&c.label<r[1]){c.label=r[1],r=u;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(u);break}r[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(e,c)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function T(e){return"string"==typeof e?e.trim():Array.isArray(e)?e.map(function(e){return T(e)}):(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="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],d=p[1],b=(0,i.useContext)(l).types,x=b.map(function(e){return S(P({},e),{onClick:function(){a(!0),d(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:x}},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:d,useCreateAction:R},schema:y})))},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;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||null==(n=t.data)?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:d,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
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("@emotion/css"),require("@nocobase/client"),require("react-router-dom"),require("@formily/shared"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["@formily/core","@formily/antd-v5","react","@emotion/css","@nocobase/client","react-router-dom","@formily/shared","@formily/react","@nocobase/utils/client","@ant-design/icons","antd","react-i18next"],e):"object"==typeof exports?exports["@nocobase/plugin-auth"]=e(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("@emotion/css"),require("@nocobase/client"),require("react-router-dom"),require("@formily/shared"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):t["@nocobase/plugin-auth"]=e(t["@formily/core"],t["@formily/antd-v5"],t.react,t["@emotion/css"],t["@nocobase/client"],t["react-router-dom"],t["@formily/shared"],t["@formily/react"],t["@nocobase/utils/client"],t["@ant-design/icons"],t.antd,t["react-i18next"])}(self,function(t,e,n,r,o,i,u,c,a,l,s,f){return function(){var p,d,h,y,g,v,b={851:function(t,e,n){"use strict";n.r(e),n.d(e,{PluginAuthClient:function(){return C},AuthLayout:function(){return R},useAuthenticator:function(){return s.u},useSignIn:function(){return I},AuthenticatorsContext:function(){return s.H},AuthenticatorsContextProvider:function(){return N},useRedirect:function(){return q},default:function(){return L}});var r=n(772),o=n(584),i=n(741),u=n.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=n(573),s=n(308),f=n(581);function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e,n,r,o,i,u){try{var c=t[i](u),a=c.value}catch(t){n(t);return}c.done?e(a):Promise.resolve(a).then(r,o)}function h(t,e,n){return(h=b()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&g(o,n.prototype),o}).apply(null,arguments)}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function g(t,e){return(g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function v(t){var e="function"==typeof Map?new Map:void 0;return(v=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return h(t,arguments,y(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),g(n,t)})(t)}function b(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(b=function(){return!!t})()}var m=(0,r.lazy)(function(){return f("imported_gs6osn_component",n.e("890").then(n.bind(n,387)))},"AuthProvider").AuthProvider,_=(0,r.lazy)(function(){return f("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"Options","SignInForm","SignUpForm"),E=_.Options,S=_.SignInForm,x=_.SignUpForm,O=(0,r.lazy)(function(){return f("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthLayout","SignInPage","SignUpPage"),T=O.AuthLayout,A=O.SignInPage,k=O.SignUpPage,P=(0,r.lazy)(function(){return f("imported_10vpsc8_component",n.e("851").then(n.bind(n,264)))},"Authenticator").Authenticator,w=(0,r.lazy)(function(){return f("imported_-1q5gcq5_component",n.e("104").then(n.bind(n,349)))},"TokenPolicySettings").TokenPolicySettings,j=(0,r.lazy)(function(){return f("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthenticatorsContextProvider","AuthLayout"),N=j.AuthenticatorsContextProvider,R=j.AuthLayout,C=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function n(){var t,e,r,i,u,c;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,r=arguments,e=y(e),i=t=function(t,e){var n;if(e&&("object"==((n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,b()?Reflect.construct(e,r||[],y(this).constructor):e.apply(this,r)),u="authTypes",c=new o.Registry,u in i?Object.defineProperty(i,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):i[u]=c,t}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&g(n,t),e=[{key:"registerType",value:function(t,e){this.authTypes.register(t,e)}},{key:"load",value:function(){var t,e=this;return(t=function(){var t,n,r;return function(t,e){var n,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){var a=[i,c];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(o){var i,u;return e.app.pluginSettingsManager.add(l.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(l.A7,'" })}}'),aclSnippet:"pm.auth"}),e.app.pluginSettingsManager.add("auth.authenticators",{icon:"LoginOutlined",title:'{{t("Authenticators", { ns: "'.concat(l.A7,'" })}}'),Component:P,aclSnippet:"pm.auth.authenticators",sort:1}),e.router.add("auth",{Component:"AuthLayout"}),e.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),e.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),e.app.addComponents({AuthLayout:T,SignInPage:A,SignUpPage:k}),e.app.providers.unshift([m,{}]),e.registerType("Email/Password",{components:{SignInForm:S,SignUpForm:x,AdminSettingsForm:E}}),e.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(l.A7,'" })}}'),Component:w,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),(i=({app:e.app}).app).apiClient.axios,n=(t=function(t){if(Array.isArray(t))return t}(u=[function(t){var e,n=null==t||null==(e=t.headers)?void 0:e["x-new-token"];return n&&i.apiClient.auth.setToken(n),t},function(t){var e,n,r,o,u,l=null==t||null==(n=t.response)||null==(e=n.headers)?void 0:e["x-new-token"],s=null==t||null==(o=t.response)||null==(r=o.data)?void 0:r.errors,f=Array.isArray(s)?s[0]:null,p=i.router.state.location,d=p.pathname,h=p.search,y=i.router.basename;if(l&&i.apiClient.auth.setToken(l),401===t.status&&(null==f?void 0:f.code)&&c[f.code]&&(i.apiClient.auth.setToken(""),d===i.getHref("signin")&&(null==f?void 0:f.code)!==c.EMPTY_TOKEN&&t.config&&(t.config.skipNotify=!1),(null==f?void 0:f.code)==="USER_HAS_NO_ROLES_ERR"&&(t.config.skipNotify=!0,i.error=f)),401===t.status&&!(null==(u=t.config)?void 0:u.skipAuth)&&(null==f?void 0:f.code)&&c[f.code]){if(!f||(null==f?void 0:f.code)===c.SKIP_TOKEN_RENEW)throw t;var g=i.router.isSkippedAuthCheckRoute(d);if(g&&(t.config.skipNotify=!0),d!==i.getHref("signin")&&!g){var v,b,m=(v=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),b=new RegExp("^".concat(v.replace(/\/?$/,""),"(\\/|$)")),d.replace(b,"/")||d);a(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(m).concat(h),{replace:!0})})}}throw t}])||function(t,e){var n,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=(n=o.next()).done)&&(i.push(n.value),i.length!==e);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,e){if(t){if("string"==typeof t)return p(t,2);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(t,e)}}(u,2)||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],e.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:n,rejected:r,synchronous:!1,runWhen:null}),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);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)})})()}}],function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(n.prototype,e),n}(v(r.Plugin)),I=function(t){return(0,r.useLazy)(function(){return f("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"useSignIn")(t)},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/admin";return(0,r.useLazy)(function(){return f("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"useRedirect")(t)},L=C},308:function(t,e,n){"use strict";n.d(e,{H:function(){return o},u:function(){return i}});var r=n(156),o=(0,r.createContext)([]);o.displayName="AuthenticatorsContext";var i=function(t){return(0,r.useContext)(o).find(function(e){return e.name===t})}},573:function(t,e,n){"use strict";n.d(e,{A7:function(){return i},KQ:function(){return c},o$:function(){return u}});var r=n(238),o=n(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,e,n){t.exports=n(31).Symbol},365:function(t,e,n){var r=n(869),o=n(43),i=n(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,e,n){var r=n(670),o=/^\s+/;t.exports=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t}},274:function(t,e,n){t.exports="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g},43:function(t,e,n){var r=n(869),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,c=r?r.toStringTag:void 0;t.exports=function(t){var e=i.call(t,c),n=t[c];try{t[c]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(e?t[c]=n:delete t[c]),o}},283:function(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},31:function(t,e,n){var r=n(274),o="object"==typeof self&&self&&self.Object===Object&&self;t.exports=r||o||Function("return this")()},670:function(t){var e=/\s/;t.exports=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}},741:function(t,e,n){var r=n(917),o=n(860),i=n(640),u=Math.max,c=Math.min;t.exports=function(t,e,n){var a,l,s,f,p,d,h=0,y=!1,g=!1,v=!0;if("function"!=typeof t)throw TypeError("Expected a function");function b(e){var n=a,r=l;return a=l=void 0,h=e,f=t.apply(r,n)}function m(t){var n=t-d,r=t-h;return void 0===d||n>=e||n<0||g&&r>=s}function _(){var t,n,r,i=o();if(m(i))return E(i);p=setTimeout(_,(t=i-d,n=i-h,r=e-t,g?c(r,s-n):r))}function E(t){return(p=void 0,v&&a)?b(t):(a=l=void 0,f)}function S(){var t,n=o(),r=m(n);if(a=arguments,l=this,d=n,r){if(void 0===p)return h=t=d,p=setTimeout(_,e),y?b(t):f;if(g)return clearTimeout(p),p=setTimeout(_,e),b(d)}return void 0===p&&(p=setTimeout(_,e)),f}return e=i(e)||0,r(n)&&(y=!!n.leading,s=(g="maxWait"in n)?u(i(n.maxWait)||0,e):s,v="trailing"in n?!!n.trailing:v),S.cancel=function(){void 0!==p&&clearTimeout(p),h=0,a=d=l=p=void 0},S.flush=function(){return void 0===p?f:E(o())},S}},917:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},620:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},528:function(t,e,n){var r=n(365),o=n(620);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},860:function(t,e,n){var r=n(31);t.exports=function(){return r.Date.now()}},640:function(t,e,n){var r=n(527),o=n(917),i=n(528),u=0/0,c=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,s=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return u;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=r(t);var n=a.test(t);return n||l.test(t)?s(t.slice(2),n?2:8):c.test(t)?u:+t}},581:function(t){t.exports=function(t,e){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(t,e),e}},482:function(t){"use strict";t.exports=l},964:function(t){"use strict";t.exports=r},632:function(t){"use strict";t.exports=e},563:function(e){"use strict";e.exports=t},505:function(t){"use strict";t.exports=c},875:function(t){"use strict";t.exports=u},772:function(t){"use strict";t.exports=o},584:function(t){"use strict";t.exports=a},721:function(t){"use strict";t.exports=s},156:function(t){"use strict";t.exports=n},238:function(t){"use strict";t.exports=f},128:function(t){"use strict";t.exports=i}},m={};function _(t){var e=m[t];if(void 0!==e)return e.exports;var n=m[t]={exports:{}};return b[t](n,n.exports,_),n.exports}return _.m=b,_.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return _.d(e,{a:e}),e},_.d=function(t,e){for(var n in e)_.o(e,n)&&!_.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},_.f={},_.e=function(t){return Promise.all(Object.keys(_.f).reduce(function(e,n){return _.f[n](t,e),e},[]))},_.u=function(t){return""+({104:"d4996e8933eb7108",280:"6fd58e93d1d6f624",851:"258b56d2c2c77321",890:"c9e429985a4f45a5",938:"ad16a7f5caf476e7"})[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,e){return Object.prototype.hasOwnProperty.call(t,e)},p={},d="@nocobase/plugin-auth:",_.l=function(t,e,n,r){if(p[t])return void p[t].push(e);if(void 0!==n)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+n){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+n),o.src=t),p[t]=[e];var l=function(e,n){o.onerror=o.onload=null,clearTimeout(s);var r=p[t];if(delete p[t],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(t){return t(n)}),e)return e(n)},s=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})},(h=window.__nocobase_public_path__||"/").endsWith("/")||(h+="/"),_.p=h+"static/plugins/@nocobase/plugin-auth/dist/client/",y={909:0},_.f.j=function(t,e){var n=_.o(y,t)?y[t]:void 0;if(0!==n)if(n)e.push(n[2]);else{var r=new Promise(function(e,r){n=y[t]=[e,r]});e.push(n[2]=r);var o=_.p+_.u(t),i=Error();_.l(o,function(e){if(_.o(y,t)&&(0!==(n=y[t])&&(y[t]=void 0),n)){var r=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src;i.message="Loading chunk "+t+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+t,t)}},g=function(t,e){var n,r,o=e[0],i=e[1],u=e[2],c=0;if(o.some(function(t){return 0!==y[t]})){for(n in i)_.o(i,n)&&(_.m[n]=i[n]);u&&u(_)}for(t&&t(e);c<o.length;c++)r=o[c],_.o(y,r)&&y[r]&&y[r][0](),y[r]=0},(v=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(g.bind(null,0)),v.push=g.bind(null,v.push.bind(v)),_(851)}()});
10
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("@emotion/css"),require("@nocobase/client"),require("react-router-dom"),require("@formily/shared"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["@formily/core","@formily/antd-v5","react","@emotion/css","@nocobase/client","react-router-dom","@formily/shared","@formily/react","@nocobase/utils/client","@ant-design/icons","antd","react-i18next"],e):"object"==typeof exports?exports["@nocobase/plugin-auth"]=e(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("@emotion/css"),require("@nocobase/client"),require("react-router-dom"),require("@formily/shared"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):t["@nocobase/plugin-auth"]=e(t["@formily/core"],t["@formily/antd-v5"],t.react,t["@emotion/css"],t["@nocobase/client"],t["react-router-dom"],t["@formily/shared"],t["@formily/react"],t["@nocobase/utils/client"],t["@ant-design/icons"],t.antd,t["react-i18next"])}(self,function(t,e,n,r,o,i,u,a,c,l,s,f){return function(){var p,d,h,y,g,v,b={851:function(t,e,n){"use strict";n.r(e),n.d(e,{PluginAuthClient:function(){return C},AuthLayout:function(){return R},useAuthenticator:function(){return s.u},useSignIn:function(){return I},AuthenticatorsContext:function(){return s.H},AuthenticatorsContextProvider:function(){return N},useRedirect:function(){return q},default:function(){return L}});var r=n(772),o=n(584),i=n(741),u=n.n(i),a={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"},c=u()(function(t){t()},3e3,{leading:!0,trailing:!1}),l=n(573),s=n(308),f=n(581);function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){n(t);return}a.done?e(c):Promise.resolve(c).then(r,o)}function h(t,e,n){return(h=b()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&g(o,n.prototype),o}).apply(null,arguments)}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function g(t,e){return(g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function v(t){var e="function"==typeof Map?new Map:void 0;return(v=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return h(t,arguments,y(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),g(n,t)})(t)}function b(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(b=function(){return!!t})()}var m=(0,r.lazy)(function(){return f("imported_gs6osn_component",n.e("890").then(n.bind(n,387)))},"AuthProvider").AuthProvider,_=(0,r.lazy)(function(){return f("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"Options","SignInForm","SignUpForm"),E=_.Options,S=_.SignInForm,x=_.SignUpForm,O=(0,r.lazy)(function(){return f("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthLayout","SignInPage","SignUpPage"),T=O.AuthLayout,A=O.SignInPage,k=O.SignUpPage,P=(0,r.lazy)(function(){return f("imported_10vpsc8_component",n.e("851").then(n.bind(n,264)))},"Authenticator").Authenticator,w=(0,r.lazy)(function(){return f("imported_-1q5gcq5_component",n.e("104").then(n.bind(n,349)))},"TokenPolicySettings").TokenPolicySettings,j=(0,r.lazy)(function(){return f("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthenticatorsContextProvider","AuthLayout"),N=j.AuthenticatorsContextProvider,R=j.AuthLayout,C=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function n(){var t,e,r,i,u,a;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,r=arguments,e=y(e),i=t=function(t,e){var n;if(e&&("object"==((n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,b()?Reflect.construct(e,r||[],y(this).constructor):e.apply(this,r)),u="authTypes",a=new o.Registry,u in i?Object.defineProperty(i,u,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[u]=a,t}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&g(n,t),e=[{key:"registerType",value:function(t,e){this.authTypes.register(t,e)}},{key:"load",value:function(){var t,e=this;return(t=function(){var t,n,r;return function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[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){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){var i,u;return e.app.pluginSettingsManager.add(l.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(l.A7,'" })}}'),aclSnippet:"pm.auth"}),e.app.pluginSettingsManager.add("auth.authenticators",{icon:"LoginOutlined",title:'{{t("Authenticators", { ns: "'.concat(l.A7,'" })}}'),Component:P,aclSnippet:"pm.auth.authenticators",sort:1}),e.router.add("auth",{Component:"AuthLayout"}),e.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),e.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),e.app.addComponents({AuthLayout:T,SignInPage:A,SignUpPage:k}),e.app.providers.unshift([m,{}]),e.registerType("Email/Password",{components:{SignInForm:S,SignUpForm:x,AdminSettingsForm:E}}),e.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(l.A7,'" })}}'),Component:w,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),(i=({app:e.app}).app).apiClient.axios,n=(t=function(t){if(Array.isArray(t))return t}(u=[function(t){var e,n=null==t||null==(e=t.headers)?void 0:e["x-new-token"];return n&&i.apiClient.auth.setToken(n),t},function(t){var e,n,r,o,u,l=null==t||null==(n=t.response)||null==(e=n.headers)?void 0:e["x-new-token"],s=null==t||null==(o=t.response)||null==(r=o.data)?void 0:r.errors,f=Array.isArray(s)?s[0]:null,p=i.router.state.location,d=p.pathname,h=p.search,y=i.router.basename;if(l&&i.apiClient.auth.setToken(l),401===t.status&&(null==f?void 0:f.code)&&a[f.code]&&(i.apiClient.auth.setToken(""),d===i.getHref("signin")&&(null==f?void 0:f.code)!==a.EMPTY_TOKEN&&t.config&&(t.config.skipNotify=!1),(null==f?void 0:f.code)==="USER_HAS_NO_ROLES_ERR"&&(t.config.skipNotify=!0,i.error=f)),401===t.status&&!(null==(u=t.config)?void 0:u.skipAuth)&&(null==f?void 0:f.code)&&a[f.code]){if(!f||(null==f?void 0:f.code)===a.SKIP_TOKEN_RENEW)throw t;var g=i.router.isSkippedAuthCheckRoute(d);if(g&&(t.config.skipNotify=!0),d!==i.getHref("signin")&&!g){var v,b,m=(v=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),b=new RegExp("^".concat(v.replace(/\/?$/,""),"(\\/|$)")),d.replace(b,"/")||d);c(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(m).concat(h),{replace:!0})})}}throw t}])||function(t,e){var n,r,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(t);!(u=(n=o.next()).done)&&(i.push(n.value),i.length!==e);u=!0);}catch(t){a=!0,r=t}finally{try{u||null==o.return||o.return()}finally{if(a)throw r}}return i}}(u,2)||function(t,e){if(t){if("string"==typeof t)return p(t,2);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(t,e)}}(u,2)||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],e.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:n,rejected:r,synchronous:!1,runWhen:null}),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(t){d(i,r,o,u,a,"next",t)}function a(t){d(i,r,o,u,a,"throw",t)}u(void 0)})})()}}],function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(n.prototype,e),n}(v(r.Plugin)),I=function(t){return(0,r.useLazy)(function(){return f("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"useSignIn")(t)},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/admin";return(0,r.useLazy)(function(){return f("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"useRedirect")(t)},L=C},308:function(t,e,n){"use strict";n.d(e,{H:function(){return o},u:function(){return i}});var r=n(156),o=(0,r.createContext)([]);o.displayName="AuthenticatorsContext";var i=function(t){return(0,r.useContext)(o).find(function(e){return e.name===t})}},573:function(t,e,n){"use strict";n.d(e,{A7:function(){return i},KQ:function(){return a},o$:function(){return u}});var r=n(238),o=n(772),i="auth";function u(){return(0,r.useTranslation)([i,"client"],{nsMode:"fallback"})}function a(t){return o.i18n.t(t,{ns:[i,"client"],nsMode:"fallback"})}},869:function(t,e,n){t.exports=n(31).Symbol},365:function(t,e,n){var r=n(869),o=n(43),i=n(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,e,n){var r=n(670),o=/^\s+/;t.exports=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t}},274:function(t,e,n){t.exports="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g},43:function(t,e,n){var r=n(869),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(e?t[a]=n:delete t[a]),o}},283:function(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},31:function(t,e,n){var r=n(274),o="object"==typeof self&&self&&self.Object===Object&&self;t.exports=r||o||Function("return this")()},670:function(t){var e=/\s/;t.exports=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}},741:function(t,e,n){var r=n(917),o=n(860),i=n(640),u=Math.max,a=Math.min;t.exports=function(t,e,n){var c,l,s,f,p,d,h=0,y=!1,g=!1,v=!0;if("function"!=typeof t)throw TypeError("Expected a function");function b(e){var n=c,r=l;return c=l=void 0,h=e,f=t.apply(r,n)}function m(t){var n=t-d,r=t-h;return void 0===d||n>=e||n<0||g&&r>=s}function _(){var t,n,r,i=o();if(m(i))return E(i);p=setTimeout(_,(t=i-d,n=i-h,r=e-t,g?a(r,s-n):r))}function E(t){return(p=void 0,v&&c)?b(t):(c=l=void 0,f)}function S(){var t,n=o(),r=m(n);if(c=arguments,l=this,d=n,r){if(void 0===p)return h=t=d,p=setTimeout(_,e),y?b(t):f;if(g)return clearTimeout(p),p=setTimeout(_,e),b(d)}return void 0===p&&(p=setTimeout(_,e)),f}return e=i(e)||0,r(n)&&(y=!!n.leading,s=(g="maxWait"in n)?u(i(n.maxWait)||0,e):s,v="trailing"in n?!!n.trailing:v),S.cancel=function(){void 0!==p&&clearTimeout(p),h=0,c=d=l=p=void 0},S.flush=function(){return void 0===p?f:E(o())},S}},917:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},620:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},528:function(t,e,n){var r=n(365),o=n(620);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},860:function(t,e,n){var r=n(31);t.exports=function(){return r.Date.now()}},640:function(t,e,n){var r=n(527),o=n(917),i=n(528),u=0/0,a=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,s=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return u;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=r(t);var n=c.test(t);return n||l.test(t)?s(t.slice(2),n?2:8):a.test(t)?u:+t}},581:function(t){t.exports=function(t,e){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(t,e),e}},482:function(t){"use strict";t.exports=l},964:function(t){"use strict";t.exports=r},632:function(t){"use strict";t.exports=e},563:function(e){"use strict";e.exports=t},505:function(t){"use strict";t.exports=a},875:function(t){"use strict";t.exports=u},772:function(t){"use strict";t.exports=o},584:function(t){"use strict";t.exports=c},721:function(t){"use strict";t.exports=s},156:function(t){"use strict";t.exports=n},238:function(t){"use strict";t.exports=f},128:function(t){"use strict";t.exports=i}},m={};function _(t){var e=m[t];if(void 0!==e)return e.exports;var n=m[t]={exports:{}};return b[t](n,n.exports,_),n.exports}return _.m=b,_.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return _.d(e,{a:e}),e},_.d=function(t,e){for(var n in e)_.o(e,n)&&!_.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},_.f={},_.e=function(t){return Promise.all(Object.keys(_.f).reduce(function(e,n){return _.f[n](t,e),e},[]))},_.u=function(t){return""+({104:"d4996e8933eb7108",280:"6fd58e93d1d6f624",851:"b764018652890692",890:"c9e429985a4f45a5",938:"ad16a7f5caf476e7"})[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,e){return Object.prototype.hasOwnProperty.call(t,e)},p={},d="@nocobase/plugin-auth:",_.l=function(t,e,n,r){if(p[t])return void p[t].push(e);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var c=u[a];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")==d+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,_.nc&&o.setAttribute("nonce",_.nc),o.setAttribute("data-webpack",d+n),o.src=t),p[t]=[e];var l=function(e,n){o.onerror=o.onload=null,clearTimeout(s);var r=p[t];if(delete p[t],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(t){return t(n)}),e)return e(n)},s=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})},(h=window.__nocobase_public_path__||"/").endsWith("/")||(h+="/"),_.p=h+"static/plugins/@nocobase/plugin-auth/dist/client/",y={909:0},_.f.j=function(t,e){var n=_.o(y,t)?y[t]:void 0;if(0!==n)if(n)e.push(n[2]);else{var r=new Promise(function(e,r){n=y[t]=[e,r]});e.push(n[2]=r);var o=_.p+_.u(t),i=Error();_.l(o,function(e){if(_.o(y,t)&&(0!==(n=y[t])&&(y[t]=void 0),n)){var r=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src;i.message="Loading chunk "+t+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+t,t)}},g=function(t,e){var n,r,o=e[0],i=e[1],u=e[2],a=0;if(o.some(function(t){return 0!==y[t]})){for(n in i)_.o(i,n)&&(_.m[n]=i[n]);u&&u(_)}for(t&&t(e);a<o.length;a++)r=o[a],_.o(y,r)&&y[r]&&y[r][0](),y[r]=0},(v=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(g.bind(null,0)),v.push=g.bind(null,v.push.bind(v)),_(851)}()});
@@ -8,17 +8,17 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.7.0-beta.26",
11
+ "@nocobase/client": "1.7.0-beta.28",
12
12
  "react": "18.2.0",
13
- "@nocobase/utils": "1.7.0-beta.26",
13
+ "@nocobase/utils": "1.7.0-beta.28",
14
14
  "axios": "1.7.7",
15
15
  "lodash": "4.17.21",
16
- "@nocobase/auth": "1.7.0-beta.26",
17
- "@nocobase/database": "1.7.0-beta.26",
18
- "@nocobase/cache": "1.7.0-beta.26",
19
- "@nocobase/server": "1.7.0-beta.26",
20
- "@nocobase/logger": "1.7.0-beta.26",
21
- "@nocobase/test": "1.7.0-beta.26",
16
+ "@nocobase/auth": "1.7.0-beta.28",
17
+ "@nocobase/database": "1.7.0-beta.28",
18
+ "@nocobase/cache": "1.7.0-beta.28",
19
+ "@nocobase/server": "1.7.0-beta.28",
20
+ "@nocobase/logger": "1.7.0-beta.28",
21
+ "@nocobase/test": "1.7.0-beta.28",
22
22
  "@formily/antd-v5": "1.2.3",
23
23
  "antd": "5.24.2",
24
24
  "@formily/shared": "2.3.2",
@@ -27,6 +27,6 @@ module.exports = {
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.26",
30
+ "@nocobase/actions": "1.7.0-beta.28",
31
31
  "@formily/core": "2.3.0"
32
32
  };
@@ -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-04-28T07:16:58.276Z"}
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-05-06T09:27:12.048Z"}
@@ -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-04-28T07:16:58.356Z"}
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-05-06T09:27:12.126Z"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-auth",
3
- "version": "1.7.0-beta.26",
3
+ "version": "1.7.0-beta.28",
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": "01d3e77c1f4a853d1f592ac2d70916010e9c510a",
30
+ "gitHead": "38b6fdc21153e1ea4f3101114ca40624c1829179",
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,n){n.r(t),n.d(t,{Authenticator:function(){return V},useUpdateAction:function(){return _},useCreateAction:function(){return R}});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:[]});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)}l.displayName="AuthTypesContext";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"}}]},y={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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},e),n=n={refreshDeps:[r.visible]},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 }}"}}}}}}}},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,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){var u=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,o=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){c=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){c.label=u[1];break}if(6===u[0]&&c.label<r[1]){c.label=r[1],r=u;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(u);break}r[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(e,c)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}var h=function(e){var t,n,r=(0,o.useRecord)(),c=(0,o.useRequest)(function(){return Promise.resolve({data:x({},r.options)})},(t=x({},e),n=n={manual:!0},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||null==(t=n.components)?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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}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){var u=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,o=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){c=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){c.label=u[1];break}if(6===u[0]&&c.label<r[1]){c.label=r[1],r=u;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(u);break}r[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(e,c)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function T(e){return"string"==typeof e?e.trim():Array.isArray(e)?e.map(function(e){return T(e)}):(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="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],d=p[1],b=(0,i.useContext)(l).types,v=b.map(function(e){return S(P({},e),{onClick:function(){a(!0),d(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:d,useCreateAction:R},schema:y})))},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;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||null==(n=t.data)?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:d,components:{AddNew:E,Options:g},scope:{types:n,useValuesFromOptions:h,useCanNotDelete:I,t:e,useUpdateAction:_}})))}}}]);