@nocobase/plugin-auth 1.0.0-alpha.9 → 1.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +6 -6
- package/dist/client/pages/AuthLayout.d.ts +5 -2
- package/dist/externalVersion.js +8 -8
- package/dist/locale/en-US.json +2 -2
- package/dist/locale/zh-CN.json +2 -2
- package/dist/node_modules/cron/package.json +1 -1
- package/dist/server/basic-auth.js +1 -1
- package/dist/server/plugin.js +2 -4
- package/package.json +2 -2
package/dist/client/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { Plugin } from '@nocobase/client';
|
|
10
10
|
import { ComponentType } from 'react';
|
|
11
11
|
import { Authenticator as AuthenticatorType } from './authenticator';
|
|
12
|
+
export { AuthenticatorsContextProvider, AuthLayout } from './pages/AuthLayout';
|
|
12
13
|
export type AuthOptions = {
|
|
13
14
|
components: Partial<{
|
|
14
15
|
SignInForm: ComponentType<{
|
package/dist/client/index.js
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(i,
|
|
10
|
+
(function(i,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("@nocobase/utils/client"),require("react/jsx-runtime"),require("react"),require("react-router-dom"),require("react-i18next"),require("@formily/react"),require("@emotion/css"),require("antd"),require("@formily/shared"),require("@ant-design/icons")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/utils/client","react/jsx-runtime","react","react-router-dom","react-i18next","@formily/react","@emotion/css","antd","@formily/shared","@ant-design/icons"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i["@nocobase/plugin-auth"]={},i["@nocobase/client"],i["@nocobase/utils"],i.jsxRuntime,i.react,i["react-router-dom"],i["react-i18next"],i["@formily/react"],i["@emotion/css"],i.antd,i["@formily/shared"],i["@ant-design/icons"]))})(this,function(i,t,u,a,l,h,g,x,y,d,U,k){"use strict";var ue=Object.defineProperty,le=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var de=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable;var I=(i,t,u)=>t in i?ue(i,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[t]=u,C=(i,t)=>{for(var u in t||(t={}))de.call(t,u)&&I(i,u,t[u]);if(L)for(var u of L(t))ye.call(t,u)&&I(i,u,t[u]);return i},T=(i,t)=>le(i,me(t));var j=(i,t,u)=>(I(i,typeof t!="symbol"?t+"":t,u),u);var v=(i,t,u)=>new Promise((a,l)=>{var h=y=>{try{x(u.next(y))}catch(d){l(d)}},g=y=>{try{x(u.throw(y))}catch(d){l(d)}},x=y=>y.done?a(y.value):Promise.resolve(y.value).then(h,g);x((u=u.apply(i,t)).next())});const B="Email/Password",O=e=>{const n=h.useLocation(),o=t.useAPIClient();return l.useEffect(()=>{const r=new URLSearchParams(n.search),s=r.get("authenticator"),c=r.get("token");c&&(o.auth.setToken(c),o.auth.setAuthenticator(s))}),a.jsx(a.Fragment,{children:e.children})},b="auth";function A(){return g.useTranslation([b,"client"],{nsMode:"fallback"})}const S=l.createContext([]);S.displayName="AuthenticatorsContext";const F=e=>l.useContext(S).find(o=>o.name===e),q=({children:e})=>{const n=t.useAPIClient(),{data:o=[],error:r,loading:s}=t.useRequest(()=>n.resource("authenticators").publicList().then(c=>{var p;return((p=c==null?void 0:c.data)==null?void 0:p.data)||[]}));if(s)return a.jsx(d.Spin,{});if(r)throw r;return a.jsx(S.Provider,{value:o,children:e})};function D(){var n;const{data:e}=t.useSystemSettings();return a.jsxs("div",{style:{maxWidth:320,margin:"0 auto",paddingTop:"20vh"},children:[a.jsx("h1",{children:(n=e==null?void 0:e.data)==null?void 0:n.title}),a.jsx(q,{children:a.jsx(h.Outlet,{})}),a.jsx("div",{className:y.css`
|
|
11
11
|
position: absolute;
|
|
12
12
|
bottom: 24px;
|
|
13
13
|
width: 100%;
|
|
14
14
|
left: 0;
|
|
15
15
|
text-align: center;
|
|
16
|
-
`,children:
|
|
16
|
+
`,children:a.jsx(t.PoweredBy,{})})]})}const V=()=>{var r;const n=t.usePlugin(f).authTypes.getEntities(),o={};for(const[s,c]of n)(r=c.components)!=null&&r.SignInForm&&(o[s]=c.components.SignInForm);return o},_=(e=[])=>{var c;const o=t.usePlugin(f).authTypes.getEntities(),r={};for(const[p,m]of o)(c=m.components)!=null&&c.SignInButton&&(r[p]=m.components.SignInButton);const s=Object.keys(r);return e.filter(p=>s.includes(p.authType)).map((p,m)=>l.createElement(r[p.authType],{key:m,authenticator:p}))},M=()=>{const{t:e}=A();t.useCurrentDocumentTitle("Signin"),t.useViewport();const n=V(),o=l.useContext(S),r=_(o);if(!o.length)return a.jsx("div",{style:{color:"#ccc"},children:e("No authentication methods available.")});const s=o.map(c=>{const p=n[c.authType];if(!p)return;const m=`${e("Sign-in")} (${e(c.authTypeTitle||c.authType)})`;return C({component:l.createElement(p,{authenticator:c}),tabTitle:c.title||m},c)}).filter(c=>c);return a.jsxs(d.Space,{direction:"vertical",className:y.css`
|
|
17
17
|
display: flex;
|
|
18
|
-
`,children:[
|
|
18
|
+
`,children:[s.length>1?a.jsx(d.Tabs,{items:s.map(c=>({label:c.tabTitle,key:c.name,children:c.component}))}):s.length?a.jsx("div",{children:s[0].component}):a.jsx(a.Fragment,{}),a.jsx(d.Space,{direction:"vertical",className:y.css`
|
|
19
19
|
display: flex;
|
|
20
|
-
`,children:r})]})},z=l.createContext({});z.displayName="SignupPageContext";const
|
|
20
|
+
`,children:r})]})},z=l.createContext({});z.displayName="SignupPageContext";const N=()=>{var r;const n=t.usePlugin(f).authTypes.getEntities(),o={};for(const[s,c]of n)(r=c.components)!=null&&r.SignUpForm&&(o[s]=c.components.SignUpForm);return o},Z=()=>{t.useViewport(),t.useCurrentDocumentTitle("Signup");const e=N(),[n]=h.useSearchParams(),o=n.get("name"),r=F(o),{authType:s}=r||{};return e[s]?l.createElement(e[s],{authenticatorName:o}):a.jsx(h.Navigate,{to:"/not-found",replace:!0})};function K(e="/admin"){const n=h.useNavigate(),[o]=h.useSearchParams();return l.useCallback(()=>{n(o.get("redirect")||"/admin",{replace:!0})},[n,o])}const $=e=>{const n=x.useForm(),o=t.useAPIClient(),r=K(),{refreshAsync:s}=t.useCurrentUserContext();return{run(){return v(this,null,function*(){yield n.submit(),yield o.auth.signIn(n.values,e),yield s(),r()})}}},W={type:"object",name:"passwordForm","x-component":"FormV2",properties:{account:{type:"string","x-component":"Input","x-validator":`{{(value) => {
|
|
21
21
|
if (!value) {
|
|
22
22
|
return t("Please enter your username or email");
|
|
23
23
|
}
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
return t("Please enter a valid email");
|
|
27
27
|
}
|
|
28
28
|
} else {
|
|
29
|
-
return /^[^@.<>"'/]{
|
|
29
|
+
return /^[^@.<>"'/]{1,50}$/.test(value) || t("Please enter a valid username");
|
|
30
30
|
}
|
|
31
|
-
}}}`,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username/Email")}}',style:{}}},password:{type:"string","x-component":"Password",required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign in")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:"{{ useBasicSignIn }}",style:{width:"100%"}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"{{ signUpLink }}"},"x-content":'{{t("Create an account")}}',"x-visible":"{{ allowSignUp }}"}}},G=t=>{const{t:s}=A(),o=t.authenticator,{authType:r,name:n,options:a}=o,m=!!D()[r]&&(a==null?void 0:a.allowSignUp),T=`/signup?name=${n}`,ae=()=>N(n);return c.jsx(e.SchemaComponent,{schema:W,scope:{useBasicSignIn:ae,allowSignUp:m,signUpLink:T,t:s}})},H=t=>{const s=h.useNavigate(),o=x.useForm(),r=e.useAPIClient(),{t:n}=g.useTranslation();return{run(){return v(this,null,function*(){var p;yield o.submit(),yield r.auth.signUp(o.values,t==null?void 0:t.authenticator),d.message.success(((p=t==null?void 0:t.message)==null?void 0:p.success)||n("Sign up successfully, and automatically jump to the sign in page")),setTimeout(()=>{s("/signin")},2e3)})}}},J={type:"object",name:k.uid(),"x-component":"FormV2",properties:{username:{type:"string",required:!0,"x-component":"Input","x-validator":{username:!0},"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username")}}',style:{}}},password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirm_password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirm_password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Confirm password")}}',style:{}},"x-reactions":[{dependencies:[".password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign up")}}',type:"void","x-component":"Action","x-component-props":{block:!0,type:"primary",htmlType:"submit",useAction:"{{ useBasicSignUp }}",style:{width:"100%"}}}}},link:{type:"void","x-component":"div",properties:{link:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Log in with an existing account")}}'}}}}},Q=({authenticatorName:t})=>{const{t:s}=A(),o=()=>H({authenticator:t}),r=w(t),{options:n}=r;return n!=null&&n.allowSignUp?c.jsx(e.SchemaComponent,{schema:J,scope:{useBasicSignUp:o,t:s}}):c.jsx(h.Navigate,{to:"/not-found",replace:!0})},X=()=>{const{t}=A();return c.jsx(e.SchemaComponent,{scope:{t},components:{Alert:d.Alert},schema:{type:"object",properties:{public:{type:"object",properties:{allowSignUp:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Allow to sign up")}}',"x-component":"Checkbox","x-component-props":{defaultChecked:!0}}}},notice:{type:"void","x-component":"Alert","x-component-props":{showIcon:!0,message:'{{t("The authentication allows users to sign in via username or email.")}}'}}}}})},P=l.createContext({type:""});P.displayName="AuthTypeContext";const I=l.createContext({types:[]});I.displayName="AuthTypesContext";const Y=()=>{const{types:t}=l.useContext(I);return t},$={name:"authenticators",sortable:!0,fields:[{name:"id",type:"string",interface:"id"},{interface:"input",type:"string",name:"name",uiSchema:{type:"string",title:'{{t("Auth UID")}}',"x-component":"Input","x-validator":t=>/^[a-zA-Z0-9_-]+$/.test(t)?"":e.i18n.t("a-z, A-Z, 0-9, _, -"),required:!0}},{interface:"input",type:"string",name:"authType",uiSchema:{type:"string",title:'{{t("Auth Type")}}',"x-component":"Select",dataSource:"{{ types }}",required:!0}},{interface:"input",type:"string",name:"title",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"textarea",type:"string",name:"description",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input"}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},R={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(t){const s=e.useActionContext(),{type:o}=l.useContext(P);return e.useRequest(()=>Promise.resolve({data:{name:`s_${k.uid()}`,authType:o}}),b(C({},t),{refreshDeps:[s.visible]}))}},title:'{{t("Add new")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}},ee={type:"void",name:"authenticators","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:$,resourceName:"authenticators",dragSort:!0,request:{resource:"authenticators",action:"list",params:{pageSize:50,sort:"sort",appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:$},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"AddNew","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction(){const t=e.useAPIClient(),{t:s}=g.useTranslation();return{move(r,n){return v(this,null,function*(){yield t.resource("authenticators").move({sourceId:r.id,targetId:n.id}),d.message.success(s("Saved successfully"),.2)})}}}},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0,enum:"{{ types }}"}}},title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Configure")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"},"x-disabled":"{{ useCanNotDelete() }}"}}}}}}}}},te=t=>{const s=e.useRecord(),o=e.useRequest(()=>Promise.resolve({data:C({},s.options)}),b(C({},t),{manual:!0})),{run:r}=o,n=e.useActionContext();return l.useEffect(()=>{n.visible&&r()},[n.visible,r]),o},oe=t=>{var r;const o=e.usePlugin(f).authTypes.get(t);return(r=o==null?void 0:o.components)==null?void 0:r.AdminSettingsForm},ne=x.observer(()=>{const t=x.useForm(),s=e.useRecord(),o=oe(t.values.authType||s.authType);return o?c.jsx(o,{}):null},{displayName:"Options"}),se=()=>{const{setVisible:t}=e.useActionContext();return{run(){return v(this,null,function*(){t(!1)})}}},re=()=>{const{t}=g.useTranslation(),[s,o]=l.useState(!1),[r,n]=l.useState(""),a=Y(),p=a.map(m=>b(C({},m),{onClick:()=>{o(!0),n(m.value)}}));return c.jsx(e.ActionContextProvider,{value:{visible:s,setVisible:o},children:c.jsxs(P.Provider,{value:{type:r},children:[c.jsx(d.Dropdown,{menu:{items:p},children:c.jsxs(d.Button,{icon:c.jsx(q.PlusOutlined,{}),type:"primary",children:[t("Add new")," ",c.jsx(q.DownOutlined,{})]})}),c.jsx(e.SchemaComponent,{scope:{useCloseAction:se,types:a,setType:n},schema:R})]})})},ie=()=>(e.useAsyncData(),!1),ce=()=>{const{t}=A(),[s,o]=l.useState([]),r=e.useAPIClient();return e.useRequest(()=>r.resource("authenticators").listTypes().then(n=>{var p;return(((p=n==null?void 0:n.data)==null?void 0:p.data)||[]).map(m=>({key:m.name,label:t(m.title||m.name),value:m.name}))}),{onSuccess:n=>{o(n)}}),c.jsx(d.Card,{bordered:!1,children:c.jsx(I.Provider,{value:{types:s},children:c.jsx(e.SchemaComponent,{schema:ee,components:{AddNew:re,Options:ne},scope:{types:s,useValuesFromOptions:te,useCanNotDelete:ie,t}})})})};class f extends e.Plugin{constructor(){super(...arguments);j(this,"authTypes",new u.Registry)}registerType(o,r){this.authTypes.register(o,r)}load(){return v(this,null,function*(){this.app.pluginSettingsManager.add(F,{icon:"LoginOutlined",title:`{{t("Authentication", { ns: "${F}" })}}`,Component:ce,aclSnippet:"pm.auth.authenticators"}),this.router.add("auth",{Component:"AuthLayout"}),this.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),this.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),this.app.addComponents({AuthLayout:O,SignInPage:M,SignUpPage:Z}),this.app.providers.unshift([L,{}]),this.registerType(B,{components:{SignInForm:G,SignUpForm:Q,AdminSettingsForm:X}})})}}i.AuthenticatorsContext=S,i.PluginAuthClient=f,i.default=f,i.useAuthenticator=w,i.useSignIn=N,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
31
|
+
}}}`,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username/Email")}}',style:{}}},password:{type:"string","x-component":"Password",required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign in")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:"{{ useBasicSignIn }}",style:{width:"100%"}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"{{ signUpLink }}"},"x-content":'{{t("Create an account")}}',"x-visible":"{{ allowSignUp }}"}}},G=e=>{const{t:n}=A(),o=e.authenticator,{authType:r,name:s,options:c}=o,m=!!(N()[r]&&(c!=null&&c.allowSignUp)),ae=`/signup?name=${s}`,pe=()=>$(s);return a.jsx(t.SchemaComponent,{schema:W,scope:{useBasicSignIn:pe,allowSignUp:m,signUpLink:ae,t:n}})},H=e=>{const n=h.useNavigate(),o=x.useForm(),r=t.useAPIClient(),{t:s}=g.useTranslation();return{run(){return v(this,null,function*(){var p;yield o.submit(),yield r.auth.signUp(o.values,e==null?void 0:e.authenticator),d.message.success(((p=e==null?void 0:e.message)==null?void 0:p.success)||s("Sign up successfully, and automatically jump to the sign in page")),setTimeout(()=>{n("/signin")},2e3)})}}},J={type:"object",name:U.uid(),"x-component":"FormV2",properties:{username:{type:"string",required:!0,"x-component":"Input","x-validator":{username:!0},"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username")}}',style:{}}},password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirm_password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirm_password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Confirm password")}}',style:{}},"x-reactions":[{dependencies:[".password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign up")}}',type:"void","x-component":"Action","x-component-props":{block:!0,type:"primary",htmlType:"submit",useAction:"{{ useBasicSignUp }}",style:{width:"100%"}}}}},link:{type:"void","x-component":"div",properties:{link:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Log in with an existing account")}}'}}}}},Q=({authenticatorName:e})=>{const{t:n}=A(),o=()=>H({authenticator:e}),r=F(e),{options:s}=r;return s!=null&&s.allowSignUp?a.jsx(t.SchemaComponent,{schema:J,scope:{useBasicSignUp:o,t:n}}):a.jsx(h.Navigate,{to:"/not-found",replace:!0})},X=()=>{const{t:e}=A();return a.jsx(t.SchemaComponent,{scope:{t:e},components:{Alert:d.Alert},schema:{type:"object",properties:{public:{type:"object",properties:{allowSignUp:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Allow to sign up")}}',"x-component":"Checkbox",default:!0}}},notice:{type:"void","x-component":"Alert","x-component-props":{showIcon:!0,message:'{{t("The authentication allows users to sign in via username or email.")}}'}}}}})},w=l.createContext({type:""});w.displayName="AuthTypeContext";const P=l.createContext({types:[]});P.displayName="AuthTypesContext";const Y=()=>{const{types:e}=l.useContext(P);return e},E={name:"authenticators",sortable:!0,fields:[{name:"id",type:"string",interface:"id"},{interface:"input",type:"string",name:"name",uiSchema:{type:"string",title:'{{t("Auth UID")}}',"x-component":"Input","x-validator":e=>/^[a-zA-Z0-9_-]+$/.test(e)?"":t.i18n.t("a-z, A-Z, 0-9, _, -"),required:!0}},{interface:"input",type:"string",name:"authType",uiSchema:{type:"string",title:'{{t("Auth Type")}}',"x-component":"Select",dataSource:"{{ types }}",required:!0}},{interface:"input",type:"string",name:"title",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"textarea",type:"string",name:"description",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input"}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},R={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(e){const n=t.useActionContext(),{type:o}=l.useContext(w);return t.useRequest(()=>Promise.resolve({data:{name:`s_${U.uid()}`,authType:o}}),T(C({},e),{refreshDeps:[n.visible]}))}},title:'{{t("Add new")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}},ee={type:"void",name:"authenticators","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:E,resourceName:"authenticators",dragSort:!0,request:{resource:"authenticators",action:"list",params:{pageSize:50,sort:"sort",appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:E},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"AddNew","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction(){const e=t.useAPIClient(),{t:n}=g.useTranslation();return{move(r,s){return v(this,null,function*(){yield e.resource("authenticators").move({sourceId:r.id,targetId:s.id}),d.message.success(n("Saved successfully"),.2)})}}}},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0,enum:"{{ types }}"}}},title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Configure")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"},"x-disabled":"{{ useCanNotDelete() }}"}}}}}}}}},te=e=>{const n=t.useRecord(),o=t.useRequest(()=>Promise.resolve({data:C({},n.options)}),T(C({},e),{manual:!0})),{run:r}=o,s=t.useActionContext();return l.useEffect(()=>{s.visible&&r()},[s.visible,r]),o},oe=e=>{var r;const o=t.usePlugin(f).authTypes.get(e);return(r=o==null?void 0:o.components)==null?void 0:r.AdminSettingsForm},ne=x.observer(()=>{const e=x.useForm(),n=t.useRecord(),o=oe(e.values.authType||n.authType);return o?a.jsx(o,{}):null},{displayName:"Options"}),se=()=>{const{setVisible:e}=t.useActionContext();return{run(){return v(this,null,function*(){e(!1)})}}},re=()=>{const{t:e}=g.useTranslation(),[n,o]=l.useState(!1),[r,s]=l.useState(""),c=Y(),p=c.map(m=>T(C({},m),{onClick:()=>{o(!0),s(m.value)}}));return a.jsx(t.ActionContextProvider,{value:{visible:n,setVisible:o},children:a.jsxs(w.Provider,{value:{type:r},children:[a.jsx(d.Dropdown,{menu:{items:p},children:a.jsxs(d.Button,{icon:a.jsx(k.PlusOutlined,{}),type:"primary",children:[e("Add new")," ",a.jsx(k.DownOutlined,{})]})}),a.jsx(t.SchemaComponent,{scope:{useCloseAction:se,types:c,setType:s},schema:R})]})})},ie=()=>(t.useAsyncData(),!1),ce=()=>{const{t:e}=A(),[n,o]=l.useState([]),r=t.useAPIClient();return t.useRequest(()=>r.resource("authenticators").listTypes().then(s=>{var p;return(((p=s==null?void 0:s.data)==null?void 0:p.data)||[]).map(m=>({key:m.name,label:x.Schema.compile(m.title||m.name,{t:e}),value:m.name}))}),{onSuccess:s=>{o(s)}}),a.jsx(d.Card,{bordered:!1,children:a.jsx(P.Provider,{value:{types:n},children:a.jsx(t.SchemaComponent,{schema:ee,components:{AddNew:re,Options:ne},scope:{types:n,useValuesFromOptions:te,useCanNotDelete:ie,t:e}})})})};class f extends t.Plugin{constructor(){super(...arguments);j(this,"authTypes",new u.Registry)}registerType(o,r){this.authTypes.register(o,r)}load(){return v(this,null,function*(){this.app.pluginSettingsManager.add(b,{icon:"LoginOutlined",title:`{{t("Authentication", { ns: "${b}" })}}`,Component:ce,aclSnippet:"pm.auth.authenticators"}),this.router.add("auth",{Component:"AuthLayout"}),this.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),this.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),this.app.addComponents({AuthLayout:D,SignInPage:M,SignUpPage:Z}),this.app.providers.unshift([O,{}]),this.registerType(B,{components:{SignInForm:G,SignUpForm:Q,AdminSettingsForm:X}})})}}i.AuthLayout=D,i.AuthenticatorsContext=S,i.AuthenticatorsContextProvider=q,i.PluginAuthClient=f,i.default=f,i.useAuthenticator=F,i.useSignIn=$,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -6,5 +6,8 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
export declare
|
|
9
|
+
import React, { FC } from 'react';
|
|
10
|
+
export declare const AuthenticatorsContextProvider: FC<{
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function AuthLayout(): React.JSX.Element;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.0.
|
|
11
|
+
"@nocobase/client": "1.0.1-alpha.2",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"react-router-dom": "6.21.0",
|
|
14
|
-
"@nocobase/utils": "1.0.
|
|
15
|
-
"@nocobase/auth": "1.0.
|
|
16
|
-
"@nocobase/database": "1.0.
|
|
17
|
-
"@nocobase/cache": "1.0.
|
|
18
|
-
"@nocobase/server": "1.0.
|
|
19
|
-
"@nocobase/test": "1.0.
|
|
14
|
+
"@nocobase/utils": "1.0.1-alpha.2",
|
|
15
|
+
"@nocobase/auth": "1.0.1-alpha.2",
|
|
16
|
+
"@nocobase/database": "1.0.1-alpha.2",
|
|
17
|
+
"@nocobase/cache": "1.0.1-alpha.2",
|
|
18
|
+
"@nocobase/server": "1.0.1-alpha.2",
|
|
19
|
+
"@nocobase/test": "1.0.1-alpha.2",
|
|
20
20
|
"antd": "5.12.8",
|
|
21
21
|
"@formily/react": "2.3.0",
|
|
22
22
|
"@formily/shared": "2.3.0",
|
|
23
23
|
"react-i18next": "11.18.6",
|
|
24
24
|
"@emotion/css": "11.11.2",
|
|
25
25
|
"@ant-design/icons": "5.2.6",
|
|
26
|
-
"@nocobase/actions": "1.0.
|
|
26
|
+
"@nocobase/actions": "1.0.1-alpha.2"
|
|
27
27
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"Please enter a valid email": "Please enter a valid email",
|
|
18
18
|
"Please enter your username or email": "Please enter your username or email",
|
|
19
19
|
"Please enter a password": "Please enter a password",
|
|
20
|
-
"SMS": "SMS",
|
|
21
20
|
"Username/Email": "Username/Email",
|
|
22
21
|
"Auth UID": "Auth UID",
|
|
23
22
|
"The authentication allows users to sign in via username or email.": "The authentication allows users to sign in via username or email.",
|
|
24
23
|
"No authentication methods available.": "No authentication methods available.",
|
|
25
24
|
"The password is inconsistent, please re-enter": "The password is inconsistent, please re-enter",
|
|
26
|
-
"Sign-in": "Sign-in"
|
|
25
|
+
"Sign-in": "Sign-in",
|
|
26
|
+
"Password": "Password"
|
|
27
27
|
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"Please enter a valid email": "请输入有效的邮箱",
|
|
18
18
|
"Please enter your username or email": "请输入用户名或邮箱",
|
|
19
19
|
"Please enter a password": "请输入密码",
|
|
20
|
-
"SMS": "短信",
|
|
21
20
|
"Username/Email": "用户名/邮箱",
|
|
22
21
|
"Auth UID": "认证标识",
|
|
23
22
|
"The authentication allows users to sign in via username or email.": "该认证方式支持用户通过用户名或邮箱登录。",
|
|
24
23
|
"No authentication methods available.": "没有可用的认证方式。",
|
|
25
24
|
"The password is inconsistent, please re-enter": "密码不一致,请重新输入",
|
|
26
|
-
"Sign-in": "登录"
|
|
25
|
+
"Sign-in": "登录",
|
|
26
|
+
"Password": "密码"
|
|
27
27
|
}
|
|
@@ -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":"2024-
|
|
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":"2024-06-11T12:22:11.610Z"}
|
|
@@ -85,7 +85,7 @@ class BasicAuth extends import_auth.BaseAuth {
|
|
|
85
85
|
const User = ctx.db.getRepository("users");
|
|
86
86
|
const { values } = ctx.action.params;
|
|
87
87
|
const { username, password, confirm_password } = values;
|
|
88
|
-
if (
|
|
88
|
+
if (!this.validateUsername(username)) {
|
|
89
89
|
ctx.throw(400, ctx.t("Please enter a valid username", { ns: import_preset.namespace }));
|
|
90
90
|
}
|
|
91
91
|
if (!password) {
|
package/dist/server/plugin.js
CHANGED
|
@@ -46,17 +46,15 @@ var import_preset = require("../preset");
|
|
|
46
46
|
var import_auth = __toESM(require("./actions/auth"));
|
|
47
47
|
var import_authenticators = __toESM(require("./actions/authenticators"));
|
|
48
48
|
var import_basic_auth = require("./basic-auth");
|
|
49
|
-
var import_locale = require("./locale");
|
|
50
49
|
var import_authenticator = require("./model/authenticator");
|
|
51
50
|
var import_storer = require("./storer");
|
|
52
51
|
var import_token_blacklist = require("./token-blacklist");
|
|
52
|
+
var import_utils = require("@nocobase/utils");
|
|
53
53
|
class PluginAuthServer extends import_server.Plugin {
|
|
54
54
|
cache;
|
|
55
55
|
afterAdd() {
|
|
56
56
|
}
|
|
57
57
|
async beforeLoad() {
|
|
58
|
-
this.app.i18n.addResources("zh-CN", import_preset.namespace, import_locale.zhCN);
|
|
59
|
-
this.app.i18n.addResources("en-US", import_preset.namespace, import_locale.enUS);
|
|
60
58
|
this.app.db.registerModels({ AuthModel: import_authenticator.AuthModel });
|
|
61
59
|
}
|
|
62
60
|
async load() {
|
|
@@ -83,7 +81,7 @@ class PluginAuthServer extends import_server.Plugin {
|
|
|
83
81
|
}
|
|
84
82
|
this.app.authManager.registerTypes(import_preset.presetAuthType, {
|
|
85
83
|
auth: import_basic_auth.BasicAuth,
|
|
86
|
-
title: "Password"
|
|
84
|
+
title: (0, import_utils.tval)("Password", { ns: import_preset.namespace })
|
|
87
85
|
});
|
|
88
86
|
Object.entries(import_auth.default).forEach(
|
|
89
87
|
([action, handler]) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-auth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-alpha.2",
|
|
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",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"displayName.zh-CN": "用户认证",
|
|
27
27
|
"description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
|
|
28
28
|
"description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "fc5a8e3c812516f787cb22d3d198f058f45b1963",
|
|
30
30
|
"keywords": [
|
|
31
31
|
"Authentication"
|
|
32
32
|
]
|