@nocobase/plugin-auth 1.9.0-beta.2 → 1.9.0-beta.3

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([["257"],{852:function(e,t,n){n.r(t),n.d(t,{AuthLayout:function(){return m},SignInPage:function(){return T},SignUpPage:function(){return C},SignupPageContext:function(){return O},useSignInButtons:function(){return P},useSignUpForms:function(){return A},AuthenticatorsContextProvider:function(){return s},useSignInForms:function(){return E},SignupPageProvider:function(){return j}});var r=n(964),a=n(772),o=n(721),u=n(156),i=n.n(u),l=n(128),c=n(446);function f(){var e,t,n=(e=["\n position: absolute;\n bottom: 0;\n width: 100%;\n left: 0;\n text-align: center;\n padding-bottom: 24px;\n background-color: ",";\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return f=function(){return n},n}var s=function(e){var t=e.children,n=(0,a.useAPIClient)(),r=(0,a.useRequest)(function(){return n.resource("authenticators").publicList().then(function(e){var t;return(null==e||null==(t=e.data)?void 0:t.data)||[]})}),u=r.data,l=r.error;if(r.loading)return i().createElement("div",{style:{textAlign:"center",marginTop:20}},i().createElement(o.Spin,null));if(l)throw l;return i().createElement(c.H.Provider,{value:void 0===u?[]:u},t)};function m(){var e,t=((0,a.useSystemSettings)()||{}).data,n=(0,a.useToken)().token;return i().createElement("div",{style:{maxWidth:320,margin:"0 auto",paddingTop:"20vh",paddingBottom:"20vh"}},i().createElement("div",{style:{position:"fixed",top:"2em",right:"2em"}},i().createElement(a.SwitchLanguage,null)),i().createElement("h1",{style:{textAlign:"center"}},i().createElement(a.ReadPretty.TextArea,{value:null==t||null==(e=t.data)?void 0:e.title})),i().createElement(s,null,i().createElement(l.Outlet,null)),i().createElement("div",{className:(0,r.css)(f(),n.colorBgContainer)},i().createElement(a.PoweredBy,null)))}var p=n(872),y=n(748),v=n(505);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,i=!1;try{for(a=a.call(e);!(u=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){i=!0,r=e}finally{try{u||null==a.return||a.return()}finally{if(i)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function b(){var e=h(["\n display: flex;\n "]);return b=function(){return e},e}function S(){var e=h(["\n display: flex;\n "]);return S=function(){return e},e}var E=function(){var e=(0,a.usePlugin)(p.default).authTypes.getEntities(),t={},n=!0,r=!1,o=void 0;try{for(var u,i=e[Symbol.iterator]();!(n=(u=i.next()).done);n=!0){var l,c=g(u.value,2),f=c[0],s=c[1];(null==(l=s.components)?void 0:l.SignInForm)&&(t[f]=s.components.SignInForm)}}catch(e){r=!0,o=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}return t},P=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,a.usePlugin)(p.default).authTypes.getEntities(),n={},r=!0,o=!1,u=void 0;try{for(var l,c=t[Symbol.iterator]();!(r=(l=c.next()).done);r=!0){var f,s=g(l.value,2),m=s[0],y=s[1];(null==(f=y.components)?void 0:f.SignInButton)&&(n[m]=y.components.SignInButton)}}catch(e){o=!0,u=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw u}}var v=Object.keys(n);return e.filter(function(e){return v.includes(e.authType)}).map(function(e,t){return i().createElement(n[e.authType],{key:t,authenticator:e})})},T=function(){var e=(0,y.o$)().t;(0,a.useCurrentDocumentTitle)("Signin"),(0,a.useViewport)();var t=E(),n=(0,u.useContext)(c.H),l=P(n);if(!n.length)return i().createElement("div",{style:{color:"#ccc"}},e("No authentication methods available."));var f=n.map(function(n){var r=t[n.authType];if(r){var a="".concat(e("Sign-in")," (").concat(v.Schema.compile(n.authTypeTitle||n.authType,{t:e}),")");return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({component:(0,u.createElement)(r,{authenticator:n}),tabTitle:n.title||a},n)}}).filter(function(e){return e});return i().createElement(o.Space,{direction:"vertical",className:(0,r.css)(b())},f.length>1?i().createElement(o.Tabs,{items:f.map(function(e){return{label:e.tabTitle,key:e.name,children:e.component}})}):f.length?i().createElement("div",null,f[0].component):i().createElement(i().Fragment,null),i().createElement(o.Space,{direction:"vertical",className:(0,r.css)(S())},l))};function w(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 x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,i=!1;try{for(a=a.call(e);!(u=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){i=!0,r=e}finally{try{u||null==a.return||a.return()}finally{if(i)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return w(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 w(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 O=(0,u.createContext)({});O.displayName="SignupPageContext";var j=function(e){var t=(0,u.useContext)(O);return t[e.authType]={component:e.component},i().createElement(O.Provider,{value:t},e.children)},A=function(){var e=(0,a.usePlugin)(p.default).authTypes.getEntities(),t={},n=!0,r=!1,o=void 0;try{for(var u,i=e[Symbol.iterator]();!(n=(u=i.next()).done);n=!0){var l,c=x(u.value,2),f=c[0],s=c[1];(null==(l=s.components)?void 0:l.SignUpForm)&&(t[f]=s.components.SignUpForm)}}catch(e){r=!0,o=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}return t},C=function(){(0,a.useViewport)(),(0,a.useCurrentDocumentTitle)("Signup");var e=A(),t=x((0,l.useSearchParams)(),1)[0].get("name"),n=((0,c.u)(t)||{}).authType;return e[n]?(0,u.createElement)(e[n],{authenticatorName:t}):i().createElement(l.Navigate,{to:"/not-found",replace:!0})}}}]);
@@ -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("react-i18next"),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")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["react-i18next","@formily/core","@formily/antd-v5","react","@emotion/css","@nocobase/client","react-router-dom","@formily/shared","@formily/react","@nocobase/utils/client","@ant-design/icons","antd"],e):"object"==typeof exports?exports["@nocobase/plugin-auth"]=e(require("react-i18next"),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")):t["@nocobase/plugin-auth"]=e(t["react-i18next"],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)}(self,function(t,e,n,r,o,i,u,a,c,s,l,f){return function(){var p,d,y,h,m,b,v={872:function(t,e,n){"use strict";n.r(e),n.d(e,{PluginAuthClient:function(){return H},AuthLayout:function(){return B},useAuthenticator:function(){return h.u},useSignIn:function(){return X},AuthenticatorsContext:function(){return h.H},AuthenticatorsContextProvider:function(){return W},useRedirect:function(){return G},default:function(){return V}});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}),s=n(748),l=n(505),f=n(156),p=n.n(f),d=n(721),y=n(128),h=n(446);function m(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 b(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 v(t,e){return function(t){if(Array.isArray(t))return t}(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),!e||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}}(t,e)||function(t,e){if(t){if("string"==typeof t)return m(t,e);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 m(t,e)}}(t,e)||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 g=function(){var t,e=(0,s.o$)().t,n=v((0,y.useSearchParams)(),1)[0].get("name"),o=(0,h.u)(n);return(null==o||null==(t=o.options)?void 0:t.enableResetPassword)?p().createElement(r.SchemaComponent,{schema:{type:"object",name:"forgotPasswordForm","x-component":"FormV2",properties:{email:{type:"string","x-component":"Input",title:'{{t("Reset password")}}',required:!0,"x-validator":"{{(value) => {\n if (!value) {\n return '';\n }\n if (!/^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$/.test(value)) {\n return t(\"Please enter a valid email\");\n }\n }}}","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter your email")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Send reset email")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:function(){var t=(0,l.useForm)(),e=(0,r.useAPIClient)(),n=(0,s.o$)().t,o=v(p().useState(!1),2),i=o[0],u=o[1];return{run:function(){var r;return(r=function(){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(r){switch(r.label){case 0:return[4,t.submit()];case 1:r.sent(),u(!0),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,e.auth.lostPassword(t.values)];case 3:return r.sent(),[3,5];case 4:return u(!1),[7];case 5:return d.message.success(n("Reset email sent successfully")),t.reset(),[2]}})},function(){var t=this,e=arguments;return new Promise(function(n,o){var i=r.apply(t,e);function u(t){b(i,n,o,u,a,"next",t)}function a(t){b(i,n,o,u,a,"throw",t)}u(void 0)})})()},loading:i}}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Back to login")}}'}}},scope:{t:e}}):p().createElement(y.Navigate,{to:"/not-found",replace:!0})};function w(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 x(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 S(t,e){return function(t){if(Array.isArray(t))return t}(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),!e||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}}(t,e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);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 w(t,e)}}(t,e)||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 O=function(){var t,e=(0,s.o$)().t,n=(0,r.useAPIClient)(),o=S((0,y.useSearchParams)(),1)[0],i=o.get("resetToken"),u=(0,r.useNavigateNoUpdate)(),a=S(p().useState(!1),2),c=a[0],m=a[1],b=o.get("name"),v=(0,h.u)(b);return((0,f.useEffect)(function(){n.auth.checkResetToken({resetToken:i}).then(function(){m(!1)}).catch(function(t){m(!0)})},[]),null==v||null==(t=v.options)?void 0:t.enableResetPassword)?!i||c?p().createElement(d.Result,{status:"403",title:e("Reset link has expired"),extra:p().createElement(d.Button,{type:"primary",onClick:function(){return u("/signin")}},e("Go to login"))}):p().createElement(r.SchemaComponent,{schema:{type:"object",name:"resetPasswordForm","x-component":"FormV2",properties:{password:{type:"string","x-component":"Password",title:'{{t("New password")}}',required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter new password")}}'}},confirmPassword:{type:"string","x-component":"Password",title:'{{t("Confirm password")}}',required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter the same password again")}}'},"x-validator":"{{(value, rules, {form}) => {\n if (!value) {\n return '';\n }\n if (value !== form.values.password) {\n return t(\"The passwords entered twice are inconsistent\");\n }\n }}}"},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Confirm")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:function(){var t=(0,l.useForm)(),e=(0,r.useAPIClient)(),n=(0,s.o$)().t,o=new URLSearchParams(window.location.search).get("resetToken"),i=S(p().useState(!1),2),u=i[0],a=i[1];return{run:function(){var r;return(r=function(){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(r){switch(r.label){case 0:return[4,t.submit()];case 1:r.sent(),a(!0),r.label=2;case 2:var i,u;return r.trys.push([2,,4,5]),[4,e.auth.resetPassword((i=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){var r;r=n[e],e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r})}return t}({},t.values),u=u={resetToken:o},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(u)):(function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n})(Object(u)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(u,t))}),i))];case 3:return r.sent(),[3,5];case 4:return a(!1),[7];case 5:return d.message.success(n("Password reset successful")),setTimeout(function(){window.location.href="/signin"},1e3),[2]}})},function(){var t=this,e=arguments;return new Promise(function(n,o){var i=r.apply(t,e);function u(t){x(i,n,o,u,a,"next",t)}function a(t){x(i,n,o,u,a,"throw",t)}u(void 0)})})()},loading:u}}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Go to login")}}'}}},scope:{t:e}}):p().createElement(y.Navigate,{to:"/not-found",replace:!0})},P=n(581);function _(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 E(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 A(t,e,n){return(A=I()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&k(o,n.prototype),o}).apply(null,arguments)}function T(t){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function k(t,e){return(k=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function j(t){var e="function"==typeof Map?new Map:void 0;return(j=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 A(t,arguments,T(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),k(n,t)})(t)}function I(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(I=function(){return!!t})()}var C=(0,r.lazy)(function(){return P("imported_gs6osn_component",n.e("642").then(n.bind(n,401)))},"AuthProvider").AuthProvider,R=(0,r.lazy)(function(){return P("imported_kl5khg_component",n.e("847").then(n.bind(n,958)))},"Options","SignInForm","SignUpForm"),N=R.Options,q=R.SignInForm,L=R.SignUpForm,F=(0,r.lazy)(function(){return P("imported_-1ja1ffa_component",n.e("257").then(n.bind(n,852)))},"AuthLayout","SignInPage","SignUpPage"),K=F.AuthLayout,U=F.SignInPage,M=F.SignUpPage,$=(0,r.lazy)(function(){return P("imported_10vpsc8_component",n.e("286").then(n.bind(n,215)))},"Authenticator").Authenticator,D=(0,r.lazy)(function(){return P("imported_-1q5gcq5_component",n.e("645").then(n.bind(n,625)))},"TokenPolicySettings").TokenPolicySettings,z=(0,r.lazy)(function(){return P("imported_-1ja1ffa_component",n.e("257").then(n.bind(n,852)))},"AuthenticatorsContextProvider","AuthLayout"),W=z.AuthenticatorsContextProvider,B=z.AuthLayout,H=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=T(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,I()?Reflect.construct(e,r||[],T(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&&k(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(s.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(s.A7,'" })}}'),aclSnippet:"pm.auth"}),e.app.pluginSettingsManager.add("auth.authenticators",{icon:"LoginOutlined",title:'{{t("Authenticators", { ns: "'.concat(s.A7,'" })}}'),Component:$,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.router.add("auth.forgotPassword",{path:"/forgot-password",Component:"ForgotPasswordPage"}),e.router.add("auth.resetPassword",{path:"/reset-password",Component:"ResetPasswordPage"}),e.app.addComponents({AuthLayout:K,SignInPage:U,SignUpPage:M,ForgotPasswordPage:g,ResetPasswordPage:O}),e.app.providers.unshift([C,{}]),e.registerType("Email/Password",{components:{SignInForm:q,SignUpForm:L,AdminSettingsForm:N}}),e.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(s.A7,'" })}}'),Component:D,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,s=null==t||null==(n=t.response)||null==(e=n.headers)?void 0:e["x-new-token"],l=null==t||null==(o=t.response)||null==(r=o.data)?void 0:r.errors,f=Array.isArray(l)?l[0]:null,p=i.router.state.location,d=p.pathname,y=p.search,h=i.router.basename;if(s&&i.apiClient.auth.setToken(s),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 m=i.router.isSkippedAuthCheckRoute(d);if(m&&(t.config.skipNotify=!0),d!==i.getHref("signin")&&!m){var b,v,g=(b=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),v=new RegExp("^".concat(b.replace(/\/?$/,""),"(\\/|$)")),d.replace(v,"/")||d);c(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(g).concat(y),{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 _(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 _(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){E(i,r,o,u,a,"next",t)}function a(t){E(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}(j(r.Plugin)),X=function(t){return(0,r.useLazy)(function(){return P("imported_kl5khg_component",n.e("847").then(n.bind(n,958)))},"useSignIn")(t)},G=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/admin";return(0,r.useLazy)(function(){return P("imported_kl5khg_component",n.e("847").then(n.bind(n,958)))},"useRedirect")(t)},V=H},446: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})}},748: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,s,l,f,p,d,y=0,h=!1,m=!1,b=!0;if("function"!=typeof t)throw TypeError("Expected a function");function v(e){var n=c,r=s;return c=s=void 0,y=e,f=t.apply(r,n)}function g(t){var n=t-d,r=t-y;return void 0===d||n>=e||n<0||m&&r>=l}function w(){var t,n,r,i=o();if(g(i))return x(i);p=setTimeout(w,(t=i-d,n=i-y,r=e-t,m?a(r,l-n):r))}function x(t){return(p=void 0,b&&c)?v(t):(c=s=void 0,f)}function S(){var t,n=o(),r=g(n);if(c=arguments,s=this,d=n,r){if(void 0===p)return y=t=d,p=setTimeout(w,e),h?v(t):f;if(m)return clearTimeout(p),p=setTimeout(w,e),v(d)}return void 0===p&&(p=setTimeout(w,e)),f}return e=i(e)||0,r(n)&&(h=!!n.leading,l=(m="maxWait"in n)?u(i(n.maxWait)||0,e):l,b="trailing"in n?!!n.trailing:b),S.cancel=function(){void 0!==p&&clearTimeout(p),y=0,c=d=s=p=void 0},S.flush=function(){return void 0===p?f:x(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,s=/^0o[0-7]+$/i,l=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||s.test(t)?l(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=o},632:function(t){"use strict";t.exports=n},563:function(t){"use strict";t.exports=e},505:function(t){"use strict";t.exports=c},875:function(t){"use strict";t.exports=a},772:function(t){"use strict";t.exports=i},584:function(t){"use strict";t.exports=s},721:function(t){"use strict";t.exports=f},156:function(t){"use strict";t.exports=r},238:function(e){"use strict";e.exports=t},128:function(t){"use strict";t.exports=u}},g={};function w(t){var e=g[t];if(void 0!==e)return e.exports;var n=g[t]={exports:{}};return v[t](n,n.exports,w),n.exports}return w.m=v,w.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return w.d(e,{a:e}),e},w.d=function(t,e){for(var n in e)w.o(e,n)&&!w.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},w.f={},w.e=function(t){return Promise.all(Object.keys(w.f).reduce(function(e,n){return w.f[n](t,e),e},[]))},w.u=function(t){return""+({257:"ef57ca1a043c2bc8",286:"8a134e884eae4f4b",642:"f57512ca2e74813f",645:"367cf457dd5bebe5",847:"662f930270b54313"})[t]+".js"},w.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),w.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},p={},d="@nocobase/plugin-auth:",w.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,w.nc&&o.setAttribute("nonce",w.nc),o.setAttribute("data-webpack",d+n),o.src=t),p[t]=[e];var s=function(e,n){o.onerror=o.onload=null,clearTimeout(l);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)},l=setTimeout(s.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=s.bind(null,o.onerror),o.onload=s.bind(null,o.onload),i&&document.head.appendChild(o)},w.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(y=window.__nocobase_public_path__||"/").endsWith("/")||(y+="/"),w.p=y+"static/plugins/@nocobase/plugin-auth/dist/client/",h={909:0},w.f.j=function(t,e){var n=w.o(h,t)?h[t]:void 0;if(0!==n)if(n)e.push(n[2]);else{var r=new Promise(function(e,r){n=h[t]=[e,r]});e.push(n[2]=r);var o=w.p+w.u(t),i=Error();w.l(o,function(e){if(w.o(h,t)&&(0!==(n=h[t])&&(h[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)}},m=function(t,e){var n,r,o=e[0],i=e[1],u=e[2],a=0;if(o.some(function(t){return 0!==h[t]})){for(n in i)w.o(i,n)&&(w.m[n]=i[n]);u&&u(w)}for(t&&t(e);a<o.length;a++)r=o[a],w.o(h,r)&&h[r]&&h[r][0](),h[r]=0},(b=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(m.bind(null,0)),b.push=m.bind(null,b.push.bind(b)),w(872)}()});
10
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react-i18next"),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")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["react-i18next","@formily/core","@formily/antd-v5","react","@emotion/css","@nocobase/client","react-router-dom","@formily/shared","@formily/react","@nocobase/utils/client","@ant-design/icons","antd"],e):"object"==typeof exports?exports["@nocobase/plugin-auth"]=e(require("react-i18next"),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")):t["@nocobase/plugin-auth"]=e(t["react-i18next"],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)}(self,function(t,e,n,r,o,i,u,a,c,s,l,f){return function(){var p,d,y,h,m,b,v={872:function(t,e,n){"use strict";n.r(e),n.d(e,{PluginAuthClient:function(){return H},AuthLayout:function(){return B},useAuthenticator:function(){return h.u},useSignIn:function(){return X},AuthenticatorsContext:function(){return h.H},AuthenticatorsContextProvider:function(){return W},useRedirect:function(){return G},default:function(){return V}});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}),s=n(748),l=n(505),f=n(156),p=n.n(f),d=n(721),y=n(128),h=n(446);function m(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 b(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 v(t,e){return function(t){if(Array.isArray(t))return t}(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),!e||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}}(t,e)||function(t,e){if(t){if("string"==typeof t)return m(t,e);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 m(t,e)}}(t,e)||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 g=function(){var t,e=(0,s.o$)().t,n=v((0,y.useSearchParams)(),1)[0].get("name"),o=(0,h.u)(n);return(null==o||null==(t=o.options)?void 0:t.enableResetPassword)?p().createElement(r.SchemaComponent,{schema:{type:"object",name:"forgotPasswordForm","x-component":"FormV2",properties:{email:{type:"string","x-component":"Input",title:'{{t("Reset password")}}',required:!0,"x-validator":"{{(value) => {\n if (!value) {\n return '';\n }\n if (!/^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$/.test(value)) {\n return t(\"Please enter a valid email\");\n }\n }}}","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter your email")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Send reset email")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:function(){var t=(0,l.useForm)(),e=(0,r.useAPIClient)(),n=(0,s.o$)().t,o=v(p().useState(!1),2),i=o[0],u=o[1];return{run:function(){var r;return(r=function(){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(r){switch(r.label){case 0:return[4,t.submit()];case 1:r.sent(),u(!0),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,e.auth.lostPassword(t.values)];case 3:return r.sent(),[3,5];case 4:return u(!1),[7];case 5:return d.message.success(n("Reset email sent successfully")),t.reset(),[2]}})},function(){var t=this,e=arguments;return new Promise(function(n,o){var i=r.apply(t,e);function u(t){b(i,n,o,u,a,"next",t)}function a(t){b(i,n,o,u,a,"throw",t)}u(void 0)})})()},loading:i}}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Back to login")}}'}}},scope:{t:e}}):p().createElement(y.Navigate,{to:"/not-found",replace:!0})};function w(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 x(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 S(t,e){return function(t){if(Array.isArray(t))return t}(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),!e||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}}(t,e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);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 w(t,e)}}(t,e)||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 O=function(){var t,e=(0,s.o$)().t,n=(0,r.useAPIClient)(),o=S((0,y.useSearchParams)(),1)[0],i=o.get("resetToken"),u=(0,r.useNavigateNoUpdate)(),a=S(p().useState(!1),2),c=a[0],m=a[1],b=o.get("name"),v=(0,h.u)(b);return((0,f.useEffect)(function(){n.auth.checkResetToken({resetToken:i}).then(function(){m(!1)}).catch(function(t){m(!0)})},[]),null==v||null==(t=v.options)?void 0:t.enableResetPassword)?!i||c?p().createElement(d.Result,{status:"403",title:e("Reset link has expired"),extra:p().createElement(d.Button,{type:"primary",onClick:function(){return u("/signin")}},e("Go to login"))}):p().createElement(r.SchemaComponent,{schema:{type:"object",name:"resetPasswordForm","x-component":"FormV2",properties:{password:{type:"string","x-component":"Password",title:'{{t("New password")}}',required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter new password")}}'}},confirmPassword:{type:"string","x-component":"Password",title:'{{t("Confirm password")}}',required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter the same password again")}}'},"x-validator":"{{(value, rules, {form}) => {\n if (!value) {\n return '';\n }\n if (value !== form.values.password) {\n return t(\"The passwords entered twice are inconsistent\");\n }\n }}}"},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Confirm")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:function(){var t=(0,l.useForm)(),e=(0,r.useAPIClient)(),n=(0,s.o$)().t,o=new URLSearchParams(window.location.search).get("resetToken"),i=S(p().useState(!1),2),u=i[0],a=i[1];return{run:function(){var r;return(r=function(){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(r){switch(r.label){case 0:return[4,t.submit()];case 1:r.sent(),a(!0),r.label=2;case 2:var i,u;return r.trys.push([2,,4,5]),[4,e.auth.resetPassword((i=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){var r;r=n[e],e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r})}return t}({},t.values),u=u={resetToken:o},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(u)):(function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n})(Object(u)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(u,t))}),i))];case 3:return r.sent(),[3,5];case 4:return a(!1),[7];case 5:return d.message.success(n("Password reset successful")),setTimeout(function(){window.location.href="/signin"},1e3),[2]}})},function(){var t=this,e=arguments;return new Promise(function(n,o){var i=r.apply(t,e);function u(t){x(i,n,o,u,a,"next",t)}function a(t){x(i,n,o,u,a,"throw",t)}u(void 0)})})()},loading:u}}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Go to login")}}'}}},scope:{t:e}}):p().createElement(y.Navigate,{to:"/not-found",replace:!0})},P=n(581);function _(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 E(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 A(t,e,n){return(A=I()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&k(o,n.prototype),o}).apply(null,arguments)}function T(t){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function k(t,e){return(k=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function j(t){var e="function"==typeof Map?new Map:void 0;return(j=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 A(t,arguments,T(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),k(n,t)})(t)}function I(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(I=function(){return!!t})()}var C=(0,r.lazy)(function(){return P("imported_gs6osn_component",n.e("642").then(n.bind(n,401)))},"AuthProvider").AuthProvider,R=(0,r.lazy)(function(){return P("imported_kl5khg_component",n.e("847").then(n.bind(n,958)))},"Options","SignInForm","SignUpForm"),N=R.Options,q=R.SignInForm,L=R.SignUpForm,F=(0,r.lazy)(function(){return P("imported_-1ja1ffa_component",n.e("257").then(n.bind(n,852)))},"AuthLayout","SignInPage","SignUpPage"),K=F.AuthLayout,U=F.SignInPage,M=F.SignUpPage,$=(0,r.lazy)(function(){return P("imported_10vpsc8_component",n.e("286").then(n.bind(n,215)))},"Authenticator").Authenticator,D=(0,r.lazy)(function(){return P("imported_-1q5gcq5_component",n.e("645").then(n.bind(n,625)))},"TokenPolicySettings").TokenPolicySettings,z=(0,r.lazy)(function(){return P("imported_-1ja1ffa_component",n.e("257").then(n.bind(n,852)))},"AuthenticatorsContextProvider","AuthLayout"),W=z.AuthenticatorsContextProvider,B=z.AuthLayout,H=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=T(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,I()?Reflect.construct(e,r||[],T(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&&k(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(s.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(s.A7,'" })}}'),aclSnippet:"pm.auth"}),e.app.pluginSettingsManager.add("auth.authenticators",{icon:"LoginOutlined",title:'{{t("Authenticators", { ns: "'.concat(s.A7,'" })}}'),Component:$,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.router.add("auth.forgotPassword",{path:"/forgot-password",Component:"ForgotPasswordPage"}),e.router.add("auth.resetPassword",{path:"/reset-password",Component:"ResetPasswordPage"}),e.app.addComponents({AuthLayout:K,SignInPage:U,SignUpPage:M,ForgotPasswordPage:g,ResetPasswordPage:O}),e.app.providers.unshift([C,{}]),e.registerType("Email/Password",{components:{SignInForm:q,SignUpForm:L,AdminSettingsForm:N}}),e.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(s.A7,'" })}}'),Component:D,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,s=null==t||null==(n=t.response)||null==(e=n.headers)?void 0:e["x-new-token"],l=null==t||null==(o=t.response)||null==(r=o.data)?void 0:r.errors,f=Array.isArray(l)?l[0]:null,p=i.router.state.location,d=p.pathname,y=p.search,h=i.router.basename;if(s&&i.apiClient.auth.setToken(s),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 m=i.router.isSkippedAuthCheckRoute(d);if(m&&(t.config.skipNotify=!0),d!==i.getHref("signin")&&!m){var b,v,g=(b=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),v=new RegExp("^".concat(b.replace(/\/?$/,""),"(\\/|$)")),d.replace(v,"/")||d);c(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(g).concat(y),{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 _(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 _(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){E(i,r,o,u,a,"next",t)}function a(t){E(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}(j(r.Plugin)),X=function(t){return(0,r.useLazy)(function(){return P("imported_kl5khg_component",n.e("847").then(n.bind(n,958)))},"useSignIn")(t)},G=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/admin";return(0,r.useLazy)(function(){return P("imported_kl5khg_component",n.e("847").then(n.bind(n,958)))},"useRedirect")(t)},V=H},446: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})}},748: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,s,l,f,p,d,y=0,h=!1,m=!1,b=!0;if("function"!=typeof t)throw TypeError("Expected a function");function v(e){var n=c,r=s;return c=s=void 0,y=e,f=t.apply(r,n)}function g(t){var n=t-d,r=t-y;return void 0===d||n>=e||n<0||m&&r>=l}function w(){var t,n,r,i=o();if(g(i))return x(i);p=setTimeout(w,(t=i-d,n=i-y,r=e-t,m?a(r,l-n):r))}function x(t){return(p=void 0,b&&c)?v(t):(c=s=void 0,f)}function S(){var t,n=o(),r=g(n);if(c=arguments,s=this,d=n,r){if(void 0===p)return y=t=d,p=setTimeout(w,e),h?v(t):f;if(m)return clearTimeout(p),p=setTimeout(w,e),v(d)}return void 0===p&&(p=setTimeout(w,e)),f}return e=i(e)||0,r(n)&&(h=!!n.leading,l=(m="maxWait"in n)?u(i(n.maxWait)||0,e):l,b="trailing"in n?!!n.trailing:b),S.cancel=function(){void 0!==p&&clearTimeout(p),y=0,c=d=s=p=void 0},S.flush=function(){return void 0===p?f:x(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,s=/^0o[0-7]+$/i,l=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||s.test(t)?l(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=o},632:function(t){"use strict";t.exports=n},563:function(t){"use strict";t.exports=e},505:function(t){"use strict";t.exports=c},875:function(t){"use strict";t.exports=a},772:function(t){"use strict";t.exports=i},584:function(t){"use strict";t.exports=s},721:function(t){"use strict";t.exports=f},156:function(t){"use strict";t.exports=r},238:function(e){"use strict";e.exports=t},128:function(t){"use strict";t.exports=u}},g={};function w(t){var e=g[t];if(void 0!==e)return e.exports;var n=g[t]={exports:{}};return v[t](n,n.exports,w),n.exports}return w.m=v,w.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return w.d(e,{a:e}),e},w.d=function(t,e){for(var n in e)w.o(e,n)&&!w.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},w.f={},w.e=function(t){return Promise.all(Object.keys(w.f).reduce(function(e,n){return w.f[n](t,e),e},[]))},w.u=function(t){return""+({257:"72664b9d33edfb6c",286:"8a134e884eae4f4b",642:"f57512ca2e74813f",645:"367cf457dd5bebe5",847:"662f930270b54313"})[t]+".js"},w.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),w.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},p={},d="@nocobase/plugin-auth:",w.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,w.nc&&o.setAttribute("nonce",w.nc),o.setAttribute("data-webpack",d+n),o.src=t),p[t]=[e];var s=function(e,n){o.onerror=o.onload=null,clearTimeout(l);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)},l=setTimeout(s.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=s.bind(null,o.onerror),o.onload=s.bind(null,o.onload),i&&document.head.appendChild(o)},w.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(y=window.__nocobase_public_path__||"/").endsWith("/")||(y+="/"),w.p=y+"static/plugins/@nocobase/plugin-auth/dist/client/",h={909:0},w.f.j=function(t,e){var n=w.o(h,t)?h[t]:void 0;if(0!==n)if(n)e.push(n[2]);else{var r=new Promise(function(e,r){n=h[t]=[e,r]});e.push(n[2]=r);var o=w.p+w.u(t),i=Error();w.l(o,function(e){if(w.o(h,t)&&(0!==(n=h[t])&&(h[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)}},m=function(t,e){var n,r,o=e[0],i=e[1],u=e[2],a=0;if(o.some(function(t){return 0!==h[t]})){for(n in i)w.o(i,n)&&(w.m[n]=i[n]);u&&u(w)}for(t&&t(e);a<o.length;a++)r=o[a],w.o(h,r)&&h[r]&&h[r][0](),h[r]=0},(b=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(m.bind(null,0)),b.push=m.bind(null,b.push.bind(b)),w(872)}()});
@@ -8,17 +8,17 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.9.0-beta.2",
11
+ "@nocobase/client": "1.9.0-beta.3",
12
12
  "react": "18.2.0",
13
- "@nocobase/utils": "1.9.0-beta.2",
13
+ "@nocobase/utils": "1.9.0-beta.3",
14
14
  "axios": "1.7.7",
15
15
  "lodash": "4.17.21",
16
- "@nocobase/auth": "1.9.0-beta.2",
17
- "@nocobase/database": "1.9.0-beta.2",
18
- "@nocobase/cache": "1.9.0-beta.2",
19
- "@nocobase/server": "1.9.0-beta.2",
20
- "@nocobase/logger": "1.9.0-beta.2",
21
- "@nocobase/test": "1.9.0-beta.2",
16
+ "@nocobase/auth": "1.9.0-beta.3",
17
+ "@nocobase/database": "1.9.0-beta.3",
18
+ "@nocobase/cache": "1.9.0-beta.3",
19
+ "@nocobase/server": "1.9.0-beta.3",
20
+ "@nocobase/logger": "1.9.0-beta.3",
21
+ "@nocobase/test": "1.9.0-beta.3",
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.9.0-beta.2",
30
+ "@nocobase/actions": "1.9.0-beta.3",
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-07-10T10:51:20.897Z"}
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-07-14T13:11:03.442Z"}
@@ -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-07-10T10:51:20.979Z"}
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-07-14T13:11:03.519Z"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-auth",
3
- "version": "1.9.0-beta.2",
3
+ "version": "1.9.0-beta.3",
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": "5ff02f5b60ed666fbf8bdea1a202635e77879ee0",
30
+ "gitHead": "e0ac03557f3e9f65af634d0b6d46c2d5f0956b28",
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([["257"],{852:function(e,t,n){n.r(t),n.d(t,{AuthLayout:function(){return m},SignInPage:function(){return w},SignUpPage:function(){return I},SignupPageContext:function(){return O},useSignInButtons:function(){return P},useSignUpForms:function(){return A},AuthenticatorsContextProvider:function(){return s},useSignInForms:function(){return E},SignupPageProvider:function(){return j}});var r=n(964),a=n(772),u=n(721),o=n(156),i=n.n(o),l=n(128),c=n(446);function f(){var e,t,n=(e=["\n position: absolute;\n bottom: 24px;\n width: 100%;\n left: 0;\n text-align: center;\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return f=function(){return n},n}var s=function(e){var t=e.children,n=(0,a.useAPIClient)(),r=(0,a.useRequest)(function(){return n.resource("authenticators").publicList().then(function(e){var t;return(null==e||null==(t=e.data)?void 0:t.data)||[]})}),o=r.data,l=r.error;if(r.loading)return i().createElement("div",{style:{textAlign:"center",marginTop:20}},i().createElement(u.Spin,null));if(l)throw l;return i().createElement(c.H.Provider,{value:void 0===o?[]:o},t)};function m(){var e,t=((0,a.useSystemSettings)()||{}).data;return i().createElement("div",{style:{maxWidth:320,margin:"0 auto",paddingTop:"20vh"}},i().createElement("div",{style:{position:"fixed",top:"2em",right:"2em"}},i().createElement(a.SwitchLanguage,null)),i().createElement("h1",{style:{textAlign:"center"}},i().createElement(a.ReadPretty.TextArea,{value:null==t||null==(e=t.data)?void 0:e.title})),i().createElement(s,null,i().createElement(l.Outlet,null)),i().createElement("div",{className:(0,r.css)(f())},i().createElement(a.PoweredBy,null)))}var y=n(872),p=n(748),v=n(505);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var u=[],o=!0,i=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(u.push(n.value),!t||u.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(i)throw r}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function b(){var e=g(["\n display: flex;\n "]);return b=function(){return e},e}function S(){var e=g(["\n display: flex;\n "]);return S=function(){return e},e}var E=function(){var e=(0,a.usePlugin)(y.default).authTypes.getEntities(),t={},n=!0,r=!1,u=void 0;try{for(var o,i=e[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l,c=h(o.value,2),f=c[0],s=c[1];(null==(l=s.components)?void 0:l.SignInForm)&&(t[f]=s.components.SignInForm)}}catch(e){r=!0,u=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw u}}return t},P=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,a.usePlugin)(y.default).authTypes.getEntities(),n={},r=!0,u=!1,o=void 0;try{for(var l,c=t[Symbol.iterator]();!(r=(l=c.next()).done);r=!0){var f,s=h(l.value,2),m=s[0],p=s[1];(null==(f=p.components)?void 0:f.SignInButton)&&(n[m]=p.components.SignInButton)}}catch(e){u=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(u)throw o}}var v=Object.keys(n);return e.filter(function(e){return v.includes(e.authType)}).map(function(e,t){return i().createElement(n[e.authType],{key:t,authenticator:e})})},w=function(){var e=(0,p.o$)().t;(0,a.useCurrentDocumentTitle)("Signin"),(0,a.useViewport)();var t=E(),n=(0,o.useContext)(c.H),l=P(n);if(!n.length)return i().createElement("div",{style:{color:"#ccc"}},e("No authentication methods available."));var f=n.map(function(n){var r=t[n.authType];if(r){var a="".concat(e("Sign-in")," (").concat(v.Schema.compile(n.authTypeTitle||n.authType,{t:e}),")");return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({component:(0,o.createElement)(r,{authenticator:n}),tabTitle:n.title||a},n)}}).filter(function(e){return e});return i().createElement(u.Space,{direction:"vertical",className:(0,r.css)(b())},f.length>1?i().createElement(u.Tabs,{items:f.map(function(e){return{label:e.tabTitle,key:e.name,children:e.component}})}):f.length?i().createElement("div",null,f[0].component):i().createElement(i().Fragment,null),i().createElement(u.Space,{direction:"vertical",className:(0,r.css)(S())},l))};function T(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 x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var u=[],o=!0,i=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(u.push(n.value),!t||u.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(i)throw r}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return T(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 T(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 O=(0,o.createContext)({});O.displayName="SignupPageContext";var j=function(e){var t=(0,o.useContext)(O);return t[e.authType]={component:e.component},i().createElement(O.Provider,{value:t},e.children)},A=function(){var e=(0,a.usePlugin)(y.default).authTypes.getEntities(),t={},n=!0,r=!1,u=void 0;try{for(var o,i=e[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l,c=x(o.value,2),f=c[0],s=c[1];(null==(l=s.components)?void 0:l.SignUpForm)&&(t[f]=s.components.SignUpForm)}}catch(e){r=!0,u=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw u}}return t},I=function(){(0,a.useViewport)(),(0,a.useCurrentDocumentTitle)("Signup");var e=A(),t=x((0,l.useSearchParams)(),1)[0].get("name"),n=((0,c.u)(t)||{}).authType;return e[n]?(0,o.createElement)(e[n],{authenticatorName:t}):i().createElement(l.Navigate,{to:"/not-found",replace:!0})}}}]);