@nocobase/plugin-auth 1.6.0-beta.8 → 1.7.0-alpha.1

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.
@@ -9,11 +9,9 @@
9
9
  import { Plugin } from '@nocobase/client';
10
10
  import { ComponentType } from 'react';
11
11
  import type { Authenticator as AuthenticatorType } from './authenticator';
12
- declare const AuthenticatorsContextProvider: import("react").LazyExoticComponent<import("react").FC<{
12
+ declare const AuthenticatorsContextProvider: import("react").FC<{
13
13
  children: import("react").ReactNode;
14
- }> | typeof import("./pages").AuthLayout>, ExportAuthLayout: import("react").LazyExoticComponent<import("react").FC<{
15
- children: import("react").ReactNode;
16
- }> | typeof import("./pages").AuthLayout>;
14
+ }>, ExportAuthLayout: typeof import("./pages").AuthLayout;
17
15
  export { ExportAuthLayout as AuthLayout, AuthenticatorsContextProvider };
18
16
  export type AuthOptions = {
19
17
  components: Partial<{
@@ -39,5 +37,6 @@ export type { Authenticator } from './authenticator';
39
37
  declare const useSignIn: (name: string) => {
40
38
  run(): Promise<void>;
41
39
  };
42
- export { useSignIn };
40
+ declare const useRedirect: (next?: string) => () => void;
41
+ export { useSignIn, useRedirect };
43
42
  export default PluginAuthClient;
@@ -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("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/shared"),require("@formily/core"),require("@emotion/css"),require("antd"),require("react-router-dom")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["@nocobase/client","@ant-design/icons","@formily/react","@formily/antd-v5","react","react-i18next","@nocobase/utils/client","@formily/shared","@formily/core","@emotion/css","antd","react-router-dom"],e):"object"==typeof exports?exports["@nocobase/plugin-auth"]=e(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/shared"),require("@formily/core"),require("@emotion/css"),require("antd"),require("react-router-dom")):t["@nocobase/plugin-auth"]=e(t["@nocobase/client"],t["@ant-design/icons"],t["@formily/react"],t["@formily/antd-v5"],t.react,t["react-i18next"],t["@nocobase/utils/client"],t["@formily/shared"],t["@formily/core"],t["@emotion/css"],t.antd,t["react-router-dom"])}(self,function(t,e,n,r,o,i,u,a,c,l,f,s){return function(){var p,d,y,h,v,b,g={851:function(t,e,n){"use strict";n.r(e),n.d(e,{AuthLayout:function(){return I},useSignIn:function(){return L},PluginAuthClient:function(){return R},AuthenticatorsContextProvider:function(){return q},default:function(){return M},AuthenticatorsContext:function(){return f.H},useAuthenticator:function(){return f.u}});var r=n("772"),o=n("584"),i=n("741"),u=n.n(i),a={SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW"},c=u()(function(t){t()},3e3,{leading:!0,trailing:!1}),l=n("573"),f=n("308"),s=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 y(t,e,n){return(y=m()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&b(o,n.prototype),o}).apply(null,arguments)}function h(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)}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function g(t){var e="function"==typeof Map?new Map:void 0;return(g=function(t){var n;if(null===t||(n=t,-1===Function.toString.call(n).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,r)}function r(){return y(t,arguments,v(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),b(r,t)})(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}var x=(0,r.lazy)(function(){return s("imported_gs6osn_component",n.e("890").then(n.bind(n,387)))},"AuthProvider").AuthProvider,_=(0,r.lazy)(function(){return s("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"Options","SignInForm","SignUpForm"),S=_.Options,w=_.SignInForm,j=_.SignUpForm,A=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthLayout","SignInPage","SignUpPage"),O=A.AuthLayout,k=A.SignInPage,T=A.SignUpPage,P=(0,r.lazy)(function(){return s("imported_10vpsc8_component",n.e("851").then(n.bind(n,264)))},"Authenticator").Authenticator,E=(0,r.lazy)(function(){return s("imported_-1q5gcq5_component",n.e("104").then(n.bind(n,349)))},"TokenPolicySettings").TokenPolicySettings,C=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthenticatorsContextProvider","AuthLayout"),q=C.AuthenticatorsContextProvider,I=C.AuthLayout,R=function(t){var e,n,r;function i(){var t,e,n,r,u,a,c;return!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,i),e=this,n=i,r=arguments,n=v(n),u=t=function(t,e){return e&&("object"===function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}(e)||"function"==typeof e)?e:function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(e,m()?Reflect.construct(n,r||[],v(e).constructor):n.apply(e,r)),a="authTypes",c=new o.Registry,a in u?Object.defineProperty(u,a,{value:c,enumerable:!0,configurable:!0,writable:!0}):u[a]=c,t}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e)}(i,t),e=i,n=[{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){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(o){var i,u,f;return e.app.pluginSettingsManager.add(l.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(l.A7,'" })}}'),Component:P,aclSnippet:"pm.auth.authenticators"}),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:O,SignInPage:k,SignUpPage:T}),e.app.providers.unshift([x,{}]),e.registerType("Email/Password",{components:{SignInForm:w,SignUpForm:j,AdminSettingsForm:S}}),e.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(l.A7,'" })}}'),Component:E,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),u=((i=({app:e.app}).app).apiClient.axios,[function(t){var e,n=null==t?void 0:null===(e=t.headers)||void 0===e?void 0:e["x-new-token"];return n&&i.apiClient.auth.setToken(n),t},function(t){var e=null==t?void 0:null===(r=t.response)||void 0===r?void 0:null===(n=r.headers)||void 0===n?void 0:n["x-new-token"];if(e&&i.apiClient.auth.setToken(e),401===t.status&&!(null===(o=t.config)||void 0===o?void 0:o.skipAuth)){null==t||null===(f=t.config)||void 0===f||null===(l=f.headers)||void 0===l||null===(u=l.Authorization)||void 0===u||u.replace(/^Bearer\s+/gi,""),i.apiClient.auth.getToken(),i.apiClient.auth.setToken("");var n,r,o,u,l,f,s,p,d=null==t?void 0:null===(p=t.response)||void 0===p?void 0:null===(s=p.data)||void 0===s?void 0:s.errors,y=Array.isArray(d)?d[0]:null;if(!y||(null==y?void 0:y.code)===a.SKIP_TOKEN_RENEW)throw t;if((null==y?void 0:y.code)==="USER_HAS_NO_ROLES_ERR")throw i.error=y,t;var h=i.router.state.location,v=h.pathname,b=h.search,g=i.router.basename;if(v!==i.getHref("signin")){var m,x,_,S=(m=v,x=g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp("^".concat(x.replace(/\/?$/,""),"(\\/|$)")),m.replace(_,"/")||m);c(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(S).concat(b),{replace:!0})})}}throw t}]),f=2,n=(t=function(t){if(Array.isArray(t))return t}(u)||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}}(u,2)||function(t,e){if(t){if("string"==typeof t)return p(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 p(t,e)}}(u,f)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],r=t[1],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)})})()}}],h(e.prototype,n),i}(g(r.Plugin)),L=function(t){return(0,r.useLazy)(function(){return s("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"useSignIn")(t)},M=R},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){var r=n(31).Symbol;t.exports=r},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){var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;t.exports=r},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,i=r||o||Function("return this")();t.exports=i},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,f,s,p,d,y=0,h=!1,v=!1,b=!0;if("function"!=typeof t)throw TypeError("Expected a function");function g(e){var n=c,r=l;return c=l=void 0,y=e,s=t.apply(r,n)}e=i(e)||0,r(n)&&(h=!!n.leading,f=(v="maxWait"in n)?u(i(n.maxWait)||0,e):f,b="trailing"in n?!!n.trailing:b);function m(t){var n=t-d,r=t-y;return void 0===d||n>=e||n<0||v&&r>=f}function x(){var t,n,r,i,u=o();if(m(u))return _(u);p=setTimeout(x,(n=(t=u)-d,r=t-y,i=e-n,v?a(i,f-r):i))}function _(t){return(p=void 0,b&&c)?g(t):(c=l=void 0,s)}function S(){var t,n=o(),r=m(n);if(c=arguments,l=this,d=n,r){if(void 0===p){;return y=t=d,p=setTimeout(x,e),h?g(t):s}if(v)return clearTimeout(p),p=setTimeout(x,e),g(d)}return void 0===p&&(p=setTimeout(x,e)),s}return S.cancel=function(){void 0!==p&&clearTimeout(p),y=0,c=d=l=p=void 0},S.flush=function(){return void 0===p?s:_(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,f=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)?f(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=e},964:function(t){"use strict";t.exports=l},632:function(t){"use strict";t.exports=r},563:function(t){"use strict";t.exports=c},505:function(t){"use strict";t.exports=n},875:function(t){"use strict";t.exports=a},772:function(e){"use strict";e.exports=t},584:function(t){"use strict";t.exports=u},721:function(t){"use strict";t.exports=f},156:function(t){"use strict";t.exports=o},238:function(t){"use strict";t.exports=i},128:function(t){"use strict";t.exports=s}},m={};function x(t){var e=m[t];if(void 0!==e)return e.exports;var n=m[t]={exports:{}};return g[t](n,n.exports,x),n.exports}return x.m=g,x.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return x.d(e,{a:e}),e},x.d=function(t,e){for(var n in e)x.o(e,n)&&!x.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},x.f={},x.e=function(t){return Promise.all(Object.keys(x.f).reduce(function(e,n){return x.f[n](t,e),e},[]))},x.u=function(t){return""+({104:"f2122264b5758d8b",280:"9e603524b127e7b4",851:"974ac9de644a1d1f",890:"43e9587ca4936ffe",938:"0091d4359312cb07"})[t]+".js"},x.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),x.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},p={},d="@nocobase/plugin-auth:",x.l=function(t,e,n,r){if(p[t]){p[t].push(e);return}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,x.nc&&o.setAttribute("nonce",x.nc),o.setAttribute("data-webpack",d+n),o.src=t),p[t]=[e];var l=function(e,n){o.onerror=o.onload=null,clearTimeout(f);var r=p[t];if(delete p[t],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(t){return t(n)}),e)return e(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},x.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},x.p=(!(y=window.__nocobase_public_path__||"/").endsWith("/")&&(y+="/"),y+"static/plugins/@nocobase/plugin-auth/dist/client/"),h={909:0},x.f.j=function(t,e){var n=x.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=x.p+x.u(t),i=Error();x.l(o,function(e){if(x.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)}}},v=function(t,e){var n=e[0],r=e[1],o=e[2],i,u,a=0;if(n.some(function(t){return 0!==h[t]})){for(i in r)x.o(r,i)&&(x.m[i]=r[i]);o&&o(x)}for(t&&t(e);a<n.length;a++)u=n[a],x.o(h,u)&&h[u]&&h[u][0](),h[u]=0},(b=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(v.bind(null,0)),b.push=v.bind(null,b.push.bind(b)),x("851")}()});
10
+ !function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react-i18next"),require("react"),require("@emotion/css"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("antd"),require("react-router-dom")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["@nocobase/client","@ant-design/icons","@formily/react","@formily/antd-v5","react-i18next","react","@emotion/css","@formily/shared","@nocobase/utils/client","@formily/core","antd","react-router-dom"],n):"object"==typeof exports?exports["@nocobase/plugin-auth"]=n(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react-i18next"),require("react"),require("@emotion/css"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("antd"),require("react-router-dom")):t["@nocobase/plugin-auth"]=n(t["@nocobase/client"],t["@ant-design/icons"],t["@formily/react"],t["@formily/antd-v5"],t["react-i18next"],t.react,t["@emotion/css"],t["@formily/shared"],t["@nocobase/utils/client"],t["@formily/core"],t.antd,t["react-router-dom"])}(self,function(t,n,e,r,o,i,u,c,a,l,f,s){return function(){var p,d,y,h,v,b,g={851:function(t,n,e){"use strict";e.r(n),e.d(n,{PluginAuthClient:function(){return C},AuthenticatorsContextProvider:function(){return R},default:function(){return K},useSignIn:function(){return q},AuthLayout:function(){return I},useRedirect:function(){return L},AuthenticatorsContext:function(){return f.H},useAuthenticator:function(){return f.u}});var r=e("772"),o=e("584"),i=e("741"),u=e.n(i),c={EMPTY_TOKEN:"EMPTY_TOKEN",EXPIRED_TOKEN:"EXPIRED_TOKEN",INVALID_TOKEN:"INVALID_TOKEN",TOKEN_RENEW_FAILED:"TOKEN_RENEW_FAILED",BLOCKED_TOKEN:"BLOCKED_TOKEN",EXPIRED_SESSION:"EXPIRED_SESSION",NOT_EXIST_USER:"NOT_EXIST_USER",SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW",USER_HAS_NO_ROLES_ERR:"USER_HAS_NO_ROLES_ERR"},a=u()(function(t){t()},3e3,{leading:!0,trailing:!1}),l=e("573"),f=e("308"),s=e(581);function p(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function d(t,n,e,r,o,i,u){try{var c=t[i](u),a=c.value}catch(t){e(t);return}c.done?n(a):Promise.resolve(a).then(r,o)}function y(t,n,e){return(y=m()?Reflect.construct:function(t,n,e){var r=[null];r.push.apply(r,n);var o=new(Function.bind.apply(t,r));return e&&b(o,e.prototype),o}).apply(null,arguments)}function h(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function b(t,n){return(b=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function g(t){var n="function"==typeof Map?new Map:void 0;return(g=function(t){var e;if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return y(t,arguments,v(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),b(r,t)})(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}var _=(0,r.lazy)(function(){return s("imported_gs6osn_component",e.e("890").then(e.bind(e,387)))},"AuthProvider").AuthProvider,E=(0,r.lazy)(function(){return s("imported_kl5khg_component",e.e("938").then(e.bind(e,510)))},"Options","SignInForm","SignUpForm"),S=E.Options,x=E.SignInForm,O=E.SignUpForm,T=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",e.e("280").then(e.bind(e,492)))},"AuthLayout","SignInPage","SignUpPage"),A=T.AuthLayout,P=T.SignInPage,w=T.SignUpPage,j=(0,r.lazy)(function(){return s("imported_10vpsc8_component",e.e("851").then(e.bind(e,264)))},"Authenticator").Authenticator,k=(0,r.lazy)(function(){return s("imported_-1q5gcq5_component",e.e("104").then(e.bind(e,349)))},"TokenPolicySettings").TokenPolicySettings,N=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",e.e("280").then(e.bind(e,492)))},"AuthenticatorsContextProvider","AuthLayout"),R=N.AuthenticatorsContextProvider,I=N.AuthLayout,C=function(t){var n,e,r;function i(){var t,n,e,r,u,c,a;return!function(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,i),n=this,e=i,r=arguments,e=v(e),u=t=function(t,n){return n&&("object"===function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}(n)||"function"==typeof n)?n:function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(n,m()?Reflect.construct(e,r||[],v(n).constructor):e.apply(n,r)),c="authTypes",a=new o.Registry,c in u?Object.defineProperty(u,c,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[c]=a,t}return!function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&b(t,n)}(i,t),n=i,e=[{key:"registerType",value:function(t,n){this.authTypes.register(t,n)}},{key:"load",value:function(){var t,n=this;return(t=function(){var t,e,r;return function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(o){var i,u,f;return n.app.pluginSettingsManager.add(l.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(l.A7,'" })}}'),aclSnippet:"pm.auth"}),n.app.pluginSettingsManager.add("auth.authenticators",{icon:"LoginOutlined",title:'{{t("Authenticators", { ns: "'.concat(l.A7,'" })}}'),Component:j,aclSnippet:"pm.auth.authenticators",sort:1}),n.router.add("auth",{Component:"AuthLayout"}),n.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),n.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),n.app.addComponents({AuthLayout:A,SignInPage:P,SignUpPage:w}),n.app.providers.unshift([_,{}]),n.registerType("Email/Password",{components:{SignInForm:x,SignUpForm:O,AdminSettingsForm:S}}),n.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(l.A7,'" })}}'),Component:k,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),u=((i=({app:n.app}).app).apiClient.axios,[function(t){var n,e=null==t?void 0:null===(n=t.headers)||void 0===n?void 0:n["x-new-token"];return e&&i.apiClient.auth.setToken(e),t},function(t){var n,e,r,o,u,l=null==t?void 0:null===(e=t.response)||void 0===e?void 0:null===(n=e.headers)||void 0===n?void 0:n["x-new-token"],f=null==t?void 0:null===(o=t.response)||void 0===o?void 0:null===(r=o.data)||void 0===r?void 0:r.errors,s=Array.isArray(f)?f[0]:null,p=i.router.state.location,d=p.pathname,y=p.search,h=i.router.basename;if(l&&i.apiClient.auth.setToken(l),401===t.status&&(null==s?void 0:s.code)&&c[s.code]&&(i.apiClient.auth.setToken(""),d===i.getHref("signin")&&(null==s?void 0:s.code)!==c.EMPTY_TOKEN&&t.config&&(t.config.skipNotify=!1),(null==s?void 0:s.code)==="USER_HAS_NO_ROLES_ERR"&&(t.config.skipNotify=!0,i.error=s)),401===t.status&&!(null===(u=t.config)||void 0===u?void 0:u.skipAuth)&&(null==s?void 0:s.code)&&c[s.code]){if(!s||(null==s?void 0:s.code)===c.SKIP_TOKEN_RENEW)throw t;if(d!==i.getHref("signin")){var v,b,g,m=(v=d,b=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=new RegExp("^".concat(b.replace(/\/?$/,""),"(\\/|$)")),v.replace(g,"/")||v);a(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(m).concat(y),{replace:!0})})}}throw t}]),f=2,e=(t=function(t){if(Array.isArray(t))return t}(u)||function(t,n){var e,r,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],u=!0,c=!1;try{for(o=o.call(t);!(u=(e=o.next()).done)&&(i.push(e.value),!n||i.length!==n);u=!0);}catch(t){c=!0,r=t}finally{try{!u&&null!=o.return&&o.return()}finally{if(c)throw r}}return i}}(u,2)||function(t,n){if(t){if("string"==typeof t)return p(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return p(t,n)}}(u,f)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],r=t[1],n.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:e,rejected:r,synchronous:!1,runWhen:null}),[2]})},function(){var n=this,e=arguments;return new Promise(function(r,o){var i=t.apply(n,e);function u(t){d(i,r,o,u,c,"next",t)}function c(t){d(i,r,o,u,c,"throw",t)}u(void 0)})})()}}],h(n.prototype,e),i}(g(r.Plugin)),q=function(t){return(0,r.useLazy)(function(){return s("imported_kl5khg_component",e.e("938").then(e.bind(e,510)))},"useSignIn")(t)},L=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/admin";return(0,r.useLazy)(function(){return s("imported_kl5khg_component",e.e("938").then(e.bind(e,510)))},"useRedirect")(t)},K=C},308:function(t,n,e){"use strict";e.d(n,{H:function(){return o},u:function(){return i}});var r=e(156),o=(0,r.createContext)([]);o.displayName="AuthenticatorsContext";var i=function(t){return(0,r.useContext)(o).find(function(n){return n.name===t})}},573:function(t,n,e){"use strict";e.d(n,{A7:function(){return i},KQ:function(){return c},o$:function(){return u}});var r=e(238),o=e(772),i="auth";function u(){return(0,r.useTranslation)([i,"client"],{nsMode:"fallback"})}function c(t){return o.i18n.t(t,{ns:[i,"client"],nsMode:"fallback"})}},869:function(t,n,e){var r=e(31).Symbol;t.exports=r},365:function(t,n,e){var r=e(869),o=e(43),i=e(283),u=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?o(t):i(t)}},527:function(t,n,e){var r=e(670),o=/^\s+/;t.exports=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t}},274:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},43:function(t,n,e){var r=e(869),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,c=r?r.toStringTag:void 0;t.exports=function(t){var n=i.call(t,c),e=t[c];try{t[c]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(n?t[c]=e:delete t[c]),o}},283:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},31:function(t,n,e){var r=e(274),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},670:function(t){var n=/\s/;t.exports=function(t){for(var e=t.length;e--&&n.test(t.charAt(e)););return e}},741:function(t,n,e){var r=e(917),o=e(860),i=e(640),u=Math.max,c=Math.min;t.exports=function(t,n,e){var a,l,f,s,p,d,y=0,h=!1,v=!1,b=!0;if("function"!=typeof t)throw TypeError("Expected a function");function g(n){var e=a,r=l;return a=l=void 0,y=n,s=t.apply(r,e)}n=i(n)||0,r(e)&&(h=!!e.leading,f=(v="maxWait"in e)?u(i(e.maxWait)||0,n):f,b="trailing"in e?!!e.trailing:b);function m(t){var e=t-d,r=t-y;return void 0===d||e>=n||e<0||v&&r>=f}function _(){var t,e,r,i,u=o();if(m(u))return E(u);p=setTimeout(_,(e=(t=u)-d,r=t-y,i=n-e,v?c(i,f-r):i))}function E(t){return(p=void 0,b&&a)?g(t):(a=l=void 0,s)}function S(){var t,e=o(),r=m(e);if(a=arguments,l=this,d=e,r){if(void 0===p){;return y=t=d,p=setTimeout(_,n),h?g(t):s}if(v)return clearTimeout(p),p=setTimeout(_,n),g(d)}return void 0===p&&(p=setTimeout(_,n)),s}return S.cancel=function(){void 0!==p&&clearTimeout(p),y=0,a=d=l=p=void 0},S.flush=function(){return void 0===p?s:E(o())},S}},917:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},620:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},528:function(t,n,e){var r=e(365),o=e(620);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},860:function(t,n,e){var r=e(31);t.exports=function(){return r.Date.now()}},640:function(t,n,e){var r=e(527),o=e(917),i=e(528),u=0/0,c=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,f=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return u;if(o(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=o(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=r(t);var e=a.test(t);return e||l.test(t)?f(t.slice(2),e?2:8):c.test(t)?u:+t}},581:function(t){t.exports=function(t,n){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(t,n),n}},482:function(t){"use strict";t.exports=n},964:function(t){"use strict";t.exports=u},632:function(t){"use strict";t.exports=r},563:function(t){"use strict";t.exports=l},505:function(t){"use strict";t.exports=e},875:function(t){"use strict";t.exports=c},772:function(n){"use strict";n.exports=t},584:function(t){"use strict";t.exports=a},721:function(t){"use strict";t.exports=f},156:function(t){"use strict";t.exports=i},238:function(t){"use strict";t.exports=o},128:function(t){"use strict";t.exports=s}},m={};function _(t){var n=m[t];if(void 0!==n)return n.exports;var e=m[t]={exports:{}};return g[t](e,e.exports,_),e.exports}return _.m=g,_.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return _.d(n,{a:n}),n},_.d=function(t,n){for(var e in n)_.o(n,e)&&!_.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},_.f={},_.e=function(t){return Promise.all(Object.keys(_.f).reduce(function(n,e){return _.f[e](t,n),n},[]))},_.u=function(t){return""+({104:"f2122264b5758d8b",280:"9e603524b127e7b4",851:"974ac9de644a1d1f",890:"43e9587ca4936ffe",938:"0091d4359312cb07"})[t]+".js"},_.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),_.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},p={},d="@nocobase/plugin-auth:",_.l=function(t,n,e,r){if(p[t]){p[t].push(n);return}if(void 0!==e){for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==t||a.getAttribute("data-webpack")==d+e){o=a;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,_.nc&&o.setAttribute("nonce",_.nc),o.setAttribute("data-webpack",d+e),o.src=t),p[t]=[n];var l=function(n,e){o.onerror=o.onload=null,clearTimeout(f);var r=p[t];if(delete p[t],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(t){return t(e)}),n)return n(e)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},_.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},_.p=(!(y=window.__nocobase_public_path__||"/").endsWith("/")&&(y+="/"),y+"static/plugins/@nocobase/plugin-auth/dist/client/"),h={909:0},_.f.j=function(t,n){var e=_.o(h,t)?h[t]:void 0;if(0!==e){if(e)n.push(e[2]);else{var r=new Promise(function(n,r){e=h[t]=[n,r]});n.push(e[2]=r);var o=_.p+_.u(t),i=Error();_.l(o,function(n){if(_.o(h,t)&&(0!==(e=h[t])&&(h[t]=void 0),e)){var r=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,e[1](i)}},"chunk-"+t,t)}}},v=function(t,n){var e=n[0],r=n[1],o=n[2],i,u,c=0;if(e.some(function(t){return 0!==h[t]})){for(i in r)_.o(r,i)&&(_.m[i]=r[i]);o&&o(_)}for(t&&t(n);c<e.length;c++)u=e[c],_.o(h,u)&&h[u]&&h[u][0](),h[u]=0},(b=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(v.bind(null,0)),b.push=v.bind(null,b.push.bind(b)),_("851")}()});
@@ -8,25 +8,25 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.6.0-beta.8",
11
+ "@nocobase/client": "1.7.0-alpha.1",
12
12
  "react": "18.2.0",
13
- "@nocobase/utils": "1.6.0-beta.8",
13
+ "@nocobase/utils": "1.7.0-alpha.1",
14
14
  "axios": "1.7.7",
15
15
  "lodash": "4.17.21",
16
- "@nocobase/auth": "1.6.0-beta.8",
17
- "@nocobase/database": "1.6.0-beta.8",
18
- "@nocobase/cache": "1.6.0-beta.8",
19
- "@nocobase/server": "1.6.0-beta.8",
20
- "@nocobase/logger": "1.6.0-beta.8",
21
- "@nocobase/test": "1.6.0-beta.8",
16
+ "@nocobase/auth": "1.7.0-alpha.1",
17
+ "@nocobase/database": "1.7.0-alpha.1",
18
+ "@nocobase/cache": "1.7.0-alpha.1",
19
+ "@nocobase/server": "1.7.0-alpha.1",
20
+ "@nocobase/logger": "1.7.0-alpha.1",
21
+ "@nocobase/test": "1.7.0-alpha.1",
22
22
  "@formily/antd-v5": "1.1.9",
23
23
  "antd": "5.12.8",
24
24
  "@formily/shared": "2.3.2",
25
25
  "@formily/react": "2.3.0",
26
- "react-router-dom": "6.21.0",
26
+ "react-router-dom": "6.28.1",
27
27
  "react-i18next": "11.18.6",
28
28
  "@emotion/css": "11.13.0",
29
- "@ant-design/icons": "5.2.6",
30
- "@nocobase/actions": "1.6.0-beta.8",
29
+ "@ant-design/icons": "5.6.1",
30
+ "@nocobase/actions": "1.7.0-alpha.1",
31
31
  "@formily/core": "2.3.0"
32
32
  };
@@ -45,5 +45,6 @@
45
45
  "The maximum time limit allowed for refreshing a Token after it expires. After this time limit, the token cannot be automatically renewed, and the user needs to log in again.": "The maximum time limit allowed for refreshing a Token after it expires. After this time limit, the token cannot be automatically renewed, and the user needs to log in again.",
46
46
  "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.",
47
47
  "Your session has expired. Please sign in again.": "Your session has expired. Please sign in again.",
48
- "Unauthenticated. Please sign in to continue.": "Unauthenticated. Please sign in to continue."
48
+ "Unauthenticated. Please sign in to continue.": "Unauthenticated. Please sign in to continue.",
49
+ "User not found. Please sign in again to continue.": "User not found. Please sign in again to continue."
49
50
  }
@@ -0,0 +1,33 @@
1
+ {
2
+ "Auth Type": "Tipo di autenticazione",
3
+ "Authenticators": "Autenticatori",
4
+ "Authentication": "Autenticazione",
5
+ "Sign in via email": "Accedi tramite email",
6
+ "Sign in via password": "Accedi tramite password",
7
+ "Not allowed to sign up": "Non consentire la registrazione",
8
+ "Allow to sign up": "Consenti la registrazione",
9
+ "The username or email is incorrect, please re-enter": "Il nome utente o l'email è errato, per favore reinserisci",
10
+ "The password is incorrect, please re-enter": "La password è errata, per favore reinserisci",
11
+ "Not a valid cellphone number, please re-enter": "Numero di cellulare non valido, per favore reinserisci",
12
+ "The phone number has been registered, please login directly": "Il numero di telefono è già registrato, accedi direttamente",
13
+ "The phone number is not registered, please register first": "Il numero di telefono non è registrato, per favore registrati prima",
14
+ "Please keep and enable at least one authenticator": "Si prega di mantenere e abilitare almeno un autenticatore",
15
+ "Allow to sign in with": "Consenti l' accesso con",
16
+ "Please enter a valid username": "Si prega di inserire un nome utente valido",
17
+ "Please enter a valid email": "Si prega di inserire un'email valida",
18
+ "Please enter your username or email": "Si prega di inserire il nome utente o l'email",
19
+ "Please enter a password": "Si prega di inserire una password",
20
+ "Username/Email": "Nome utente/Email",
21
+ "Auth UID": "ID autenticazione",
22
+ "The authentication allows users to sign in via username or email.": "L'autenticazione consente agli utenti di accedere tramite nome utente o email.",
23
+ "No authentication methods available.": "Nessun metodo di autenticazione disponibile.",
24
+ "The password is inconsistent, please re-enter": "La password non è coerente, per favore reinserisci",
25
+ "Sign-in": "Accedi",
26
+ "Password": "Password",
27
+ "The username/email or password is incorrect, please re-enter": "Il nome utente/email o la password è errato, per favore reinserisci",
28
+ "Show": "Mostra",
29
+ "Sign up settings": "Impostazioni di registrazione",
30
+ "Sign up form": "Modulo di registrazione",
31
+ "At least one of the username or email fields is required": "È richiesto almeno uno dei campi nome utente o email",
32
+ "Password is not allowed to be changed": "Non consentire cambio password"
33
+ }
@@ -44,5 +44,6 @@
44
44
  "The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)": "每次签发的 API Token 的有效期。Token 过期后,如果处于会话有效期内,并且没有超过刷新时限,服务端将自动签发新 Token 以保持用户会话,否则要求用户重新登录。(每个 Token 只能被刷新一次)",
45
45
  "The maximum time limit allowed for refreshing a Token after it expires. After this time limit, the token cannot be automatically renewed, and the user needs to log in again.": "Token 过期后允许刷新的最大时限,超过此时限后,Token 无法自动更新,用户需重新登录。",
46
46
  "Your session has expired. Please sign in again.": "您的会话已过期,请重新登录。",
47
- "Unauthenticated. Please sign in to continue.": "未认证。请登录以继续。"
47
+ "Unauthenticated. Please sign in to continue.": "未认证。请登录以继续。",
48
+ "User not found. Please sign in again to continue.": "用户不存在。请重新登录以继续。"
48
49
  }
@@ -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-02-14T16:48:26.412Z"}
1
+ {"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2025-03-11T04:43:20.797Z"}
@@ -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-02-14T16:48:26.498Z"}
1
+ {"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2025-03-11T04:43:20.881Z"}
@@ -67,7 +67,8 @@ var auth_default = {
67
67
  } else {
68
68
  key = "email";
69
69
  }
70
- const user = await ctx.db.getRepository("users").findOne({
70
+ const UserRepo = ctx.db.getRepository("users");
71
+ const user = await UserRepo.findOne({
71
72
  where: {
72
73
  [key]: currentUser[key]
73
74
  }
@@ -77,8 +78,12 @@ var auth_default = {
77
78
  if (!isValid) {
78
79
  ctx.throw(401, ctx.t("The password is incorrect, please re-enter", { ns: import_preset.namespace }));
79
80
  }
80
- user.password = newPassword;
81
- await user.save();
81
+ await UserRepo.update({
82
+ filterByTk: user.id,
83
+ values: {
84
+ password: newPassword
85
+ }
86
+ });
82
87
  ctx.body = currentUser;
83
88
  await next();
84
89
  }
@@ -165,11 +165,15 @@ class PluginAuthServer extends import_server.Plugin {
165
165
  db: this.app.db,
166
166
  cache: this.app.cache,
167
167
  logger: this.app.logger,
168
- log: this.app.log
168
+ log: this.app.log,
169
+ throw: (...args) => {
170
+ throw new Error(...args);
171
+ },
172
+ t: this.app.i18n.t
169
173
  });
170
174
  let user;
171
175
  try {
172
- user = await auth.check();
176
+ user = (await auth.checkToken()).user;
173
177
  } catch (error) {
174
178
  if (!user) {
175
179
  this.app.logger.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-auth",
3
- "version": "1.6.0-beta.8",
3
+ "version": "1.7.0-alpha.1",
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": "2257b50e1cf0b2a2873673a630e5ecc80ec2e01a",
30
+ "gitHead": "e411c9728b4d1f16b0beac16e40dd3499352b052",
31
31
  "keywords": [
32
32
  "Authentication",
33
33
  "Security"