Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nocobase/plugin-auth

Package Overview
Dependencies
Maintainers
1
Versions
371
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nocobase/plugin-auth - npm Package Compare versions

Comparing version 0.13.0-alpha.4 to 0.13.0-alpha.5

746

dist/client/index.js

@@ -1,539 +0,2 @@

(function(global, factory) {
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@nocobase/client"), require("react"), require("antd"), require("@formily/shared"), require("react-i18next"), require("@ant-design/icons"), require("@formily/react")) : typeof define === "function" && define.amd ? define(["exports", "@nocobase/client", "react", "antd", "@formily/shared", "react-i18next", "@ant-design/icons", "@formily/react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nocobase/plugin-auth"] = {}, global["@nocobase/client"], global.react, global.antd, global["@formily/shared"], global["react-i18next"], global["@ant-design/icons"], global["@formily/react"]));
})(this, function(exports2, client, require$$0, antd, shared, reactI18next, icons, react) {
"use strict";
var jsxRuntime = { exports: {} };
var reactJsxRuntime_production_min = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
function q(c, a, g) {
var b, d = {}, e = null, h = null;
void 0 !== g && (e = "" + g);
void 0 !== a.key && (e = "" + a.key);
void 0 !== a.ref && (h = a.ref);
for (b in a)
m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
if (c && c.defaultProps)
for (b in a = c.defaultProps, a)
void 0 === d[b] && (d[b] = a[b]);
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
}
reactJsxRuntime_production_min.Fragment = l;
reactJsxRuntime_production_min.jsx = q;
reactJsxRuntime_production_min.jsxs = q;
{
jsxRuntime.exports = reactJsxRuntime_production_min;
}
var jsxRuntimeExports = jsxRuntime.exports;
const AuthTypeContext = require$$0.createContext({ type: "" });
const AuthTypesContext = require$$0.createContext({ types: [] });
const useAuthTypes = () => {
const { types } = require$$0.useContext(AuthTypesContext);
return types;
};
const collection = {
name: "authenticators",
sortable: true,
fields: [
{
name: "id",
type: "string",
interface: "id"
},
{
interface: "input",
type: "string",
name: "name",
uiSchema: {
type: "string",
title: '{{t("Auth UID")}}',
"x-component": "Input",
required: true
}
},
{
interface: "input",
type: "string",
name: "authType",
uiSchema: {
type: "string",
title: '{{t("Auth Type")}}',
"x-component": "Select",
dataSource: "{{ types }}",
required: true
}
},
{
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"
}
}
]
};
const createFormSchema = {
type: "object",
properties: {
drawer: {
type: "void",
"x-component": "Action.Drawer",
"x-decorator": "Form",
"x-decorator-props": {
useValues(options) {
const ctx = client.useActionContext();
const { type: authType } = require$$0.useContext(AuthTypeContext);
return client.useRequest(
() => Promise.resolve({
data: {
name: `s_${shared.uid()}`,
authType
}
}),
{ ...options, refreshDeps: [ctx.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 }}"
}
}
}
}
}
}
}
};
const authenticatorsSchema = {
type: "void",
name: "authenticators",
"x-decorator": "ResourceActionProvider",
"x-decorator-props": {
collection,
resourceName: "authenticators",
dragSort: true,
request: {
resource: "authenticators",
action: "list",
params: {
pageSize: 50,
sort: "sort",
appends: []
}
}
},
"x-component": "CollectionProvider",
"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": {
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 api = client.useAPIClient();
const { t } = reactI18next.useTranslation();
return {
async move(from, to) {
await api.resource("authenticators").move({
sourceId: from.id,
targetId: to.id
});
antd.message.success(t("Saved successfully"), 0.2);
}
};
}
},
properties: {
id: {
type: "void",
"x-decorator": "Table.Column.Decorator",
"x-component": "Table.Column",
properties: {
id: {
type: "number",
"x-component": "CollectionField",
"x-read-pretty": true
}
}
},
name: {
type: "void",
"x-decorator": "Table.Column.Decorator",
"x-component": "Table.Column",
properties: {
name: {
type: "string",
"x-component": "CollectionField",
"x-read-pretty": true
}
}
},
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": true,
enum: "{{ types }}"
}
}
},
title: {
type: "void",
"x-decorator": "Table.Column.Decorator",
"x-component": "Table.Column",
properties: {
title: {
type: "string",
"x-component": "CollectionField",
"x-read-pretty": true
}
}
},
description: {
type: "void",
"x-decorator": "Table.Column.Decorator",
"x-component": "Table.Column",
properties: {
description: {
type: "boolean",
"x-component": "CollectionField",
"x-read-pretty": true
}
}
},
enabled: {
type: "void",
"x-decorator": "Table.Column.Decorator",
"x-component": "Table.Column",
properties: {
enabled: {
type: "boolean",
"x-component": "CollectionField",
"x-read-pretty": true
}
}
},
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() }}"
}
}
}
}
}
}
}
}
};
const useValuesFromOptions = (options) => {
const record = client.useRecord();
const result = client.useRequest(
() => Promise.resolve({
data: {
...record.options
}
}),
{
...options,
manual: true
}
);
const { run } = result;
const ctx = client.useActionContext();
require$$0.useEffect(() => {
if (ctx.visible) {
run();
}
}, [ctx.visible, run]);
return result;
};
const Options$1 = react.observer(() => {
const form = react.useForm();
const record = client.useRecord();
const component = client.useOptionsComponent(form.values.authType || record.authType);
return component;
});
const NAMESPACE = "auth";
function useAuthTranslation() {
return reactI18next.useTranslation(NAMESPACE);
}
const useCloseAction = () => {
const { setVisible } = client.useActionContext();
return {
async run() {
setVisible(false);
}
};
};
const AddNew = () => {
const { t } = reactI18next.useTranslation();
const [visible, setVisible] = require$$0.useState(false);
const [type, setType] = require$$0.useState("");
const types = useAuthTypes();
const items = types.map((item) => ({
...item,
onClick: () => {
setVisible(true);
setType(item.value);
}
}));
return /* @__PURE__ */ jsxRuntimeExports.jsx(client.ActionContextProvider, { value: { visible, setVisible }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AuthTypeContext.Provider, { value: { type }, children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(antd.Dropdown, { menu: { items }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Button, { icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.PlusOutlined, {}), type: "primary", children: [
t("Add new"),
" ",
/* @__PURE__ */ jsxRuntimeExports.jsx(icons.DownOutlined, {})
] }) }),
/* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponent, { scope: { useCloseAction, types, setType }, schema: createFormSchema })
] }) });
};
const useCanNotDelete = () => {
client.useAsyncData();
return false;
};
const Authenticator = () => {
const { t } = useAuthTranslation();
const [types, setTypes] = require$$0.useState([]);
const api = client.useAPIClient();
client.useRequest(
() => api.resource("authenticators").listTypes().then((res) => {
var _a;
const types2 = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || [];
return types2.map((type) => ({
key: type.name,
label: t(type.title || type.name),
value: type.name
}));
}),
{
onSuccess: (types2) => {
setTypes(types2);
}
}
);
return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Card, { bordered: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AuthTypesContext.Provider, { value: { types }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
client.SchemaComponent,
{
schema: authenticatorsSchema,
components: { AddNew, Options: Options$1 },
scope: { types, useValuesFromOptions, useCanNotDelete, t }
}
) }) });
};
const passwordForm = {
type: "object",
name: "passwordForm",
"x-component": "FormV2",
properties: {
account: {
type: "string",
"x-component": "Input",
"x-validator": `{{(value) => {
(function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("antd"),require("react"),require("@formily/shared"),require("react-i18next"),require("@ant-design/icons"),require("@formily/react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","antd","react","@formily/shared","react-i18next","@ant-design/icons","@formily/react"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o["@nocobase/plugin-auth"]={},o["@nocobase/client"],o.jsxRuntime,o.antd,o.react,o["@formily/shared"],o["react-i18next"],o["@ant-design/icons"],o["@formily/react"]))})(this,function(o,e,t,l,p,g,y,d,a){"use strict";var H=Object.defineProperty,J=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var P=(o,e,t)=>e in o?H(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,C=(o,e)=>{for(var t in e||(e={}))W.call(e,t)&&P(o,t,e[t]);if(F)for(var t of F(e))X.call(e,t)&&P(o,t,e[t]);return o},A=(o,e)=>J(o,Q(e));var b=(o,e,t)=>new Promise((l,p)=>{var g=a=>{try{d(t.next(a))}catch(x){p(x)}},y=a=>{try{d(t.throw(a))}catch(x){p(x)}},d=a=>a.done?l(a.value):Promise.resolve(a.value).then(g,y);d((t=t.apply(o,e)).next())});const x=p.createContext({type:""}),S=p.createContext({types:[]}),I=()=>{const{types:n}=p.useContext(S);return n},w={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",required:!0}},{interface:"input",type:"string",name:"authType",uiSchema:{type:"string",title:'{{t("Auth Type")}}',"x-component":"Select",dataSource:"{{ types }}",required:!0}},{interface:"input",type:"string",name:"title",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"textarea",type:"string",name:"description",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input"}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},D={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(n){const r=e.useActionContext(),{type:i}=p.useContext(x);return e.useRequest(()=>Promise.resolve({data:{name:`s_${g.uid()}`,authType:i}}),A(C({},n),{refreshDeps:[r.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 }}"}}}}}}}},k={type:"void",name:"authenticators","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:w,resourceName:"authenticators",dragSort:!0,request:{resource:"authenticators",action:"list",params:{pageSize:50,sort:"sort",appends:[]}}},"x-component":"CollectionProvider","x-component-props":{collection:w},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":{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 n=e.useAPIClient(),{t:r}=y.useTranslation();return{move(c,s){return b(this,null,function*(){yield n.resource("authenticators").move({sourceId:c.id,targetId:s.id}),l.message.success(r("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() }}"}}}}}}}}},q=n=>{const r=e.useRecord(),i=e.useRequest(()=>Promise.resolve({data:C({},r.options)}),A(C({},n),{manual:!0})),{run:c}=i,s=e.useActionContext();return p.useEffect(()=>{s.visible&&c()},[s.visible,c]),i},j=a.observer(()=>{const n=a.useForm(),r=e.useRecord();return e.useOptionsComponent(n.values.authType||r.authType)}),$="auth";function h(){return y.useTranslation($)}const O=()=>{const{setVisible:n}=e.useActionContext();return{run(){return b(this,null,function*(){n(!1)})}}},V=()=>{const{t:n}=y.useTranslation(),[r,i]=p.useState(!1),[c,s]=p.useState(""),m=I(),v=m.map(u=>A(C({},u),{onClick:()=>{i(!0),s(u.value)}}));return t.jsx(e.ActionContextProvider,{value:{visible:r,setVisible:i},children:t.jsxs(x.Provider,{value:{type:c},children:[t.jsx(l.Dropdown,{menu:{items:v},children:t.jsxs(l.Button,{icon:t.jsx(d.PlusOutlined,{}),type:"primary",children:[n("Add new")," ",t.jsx(d.DownOutlined,{})]})}),t.jsx(e.SchemaComponent,{scope:{useCloseAction:O,types:m,setType:s},schema:D})]})})},B=()=>(e.useAsyncData(),!1),E=()=>{const{t:n}=h(),[r,i]=p.useState([]),c=e.useAPIClient();return e.useRequest(()=>c.resource("authenticators").listTypes().then(s=>{var v;return(((v=s==null?void 0:s.data)==null?void 0:v.data)||[]).map(u=>({key:u.name,label:n(u.title||u.name),value:u.name}))}),{onSuccess:s=>{i(s)}}),t.jsx(l.Card,{bordered:!1,children:t.jsx(S.Provider,{value:{types:r},children:t.jsx(e.SchemaComponent,{schema:k,components:{AddNew:V,Options:j},scope:{types:r,useValuesFromOptions:q,useCanNotDelete:B,t:n}})})})},L={type:"object",name:"passwordForm","x-component":"FormV2",properties:{account:{type:"string","x-component":"Input","x-validator":`{{(value) => {
if (!value) {

@@ -549,207 +12,2 @@ return t("Please enter your username or email");

}
}}}`,
"x-decorator": "FormItem",
"x-component-props": { placeholder: '{{t("Username/Email")}}', style: {} }
},
password: {
type: "string",
"x-component": "Password",
required: true,
"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: true,
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 }}"
}
}
};
const SigninPage = (props) => {
const { t } = useAuthTranslation();
const authenticator = props.authenticator;
const { authType, name, options } = authenticator;
const signupPages = require$$0.useContext(client.SignupPageContext);
const allowSignUp = !!signupPages[authType] && (options == null ? void 0 : options.allowSignup);
const signupLink = `/signup?authType=${authType}&name=${name}`;
const useBasicSignIn = () => {
return client.useSignIn(name);
};
return /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponent, { schema: passwordForm, scope: { useBasicSignIn, allowSignUp, signupLink, t } });
};
const presetAuthType = "Email/Password";
const signupPageSchema = {
type: "object",
name: shared.uid(),
"x-component": "FormV2",
properties: {
username: {
type: "string",
required: true,
"x-component": "Input",
"x-validator": { username: true },
"x-decorator": "FormItem",
"x-component-props": { placeholder: '{{t("Username")}}', style: {} }
},
password: {
type: "string",
required: true,
"x-component": "Password",
"x-decorator": "FormItem",
"x-component-props": { placeholder: '{{t("Password")}}', checkStrength: true, 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: true,
"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: true,
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")}}'
}
}
}
}
};
const SignupPage = (props) => {
const { t } = useAuthTranslation();
const useBasicSignup = () => {
return client.useSignup({ authenticator: props.name });
};
return /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponent, { schema: signupPageSchema, scope: { useBasicSignup, t } });
};
const Options = () => {
const { t } = useAuthTranslation();
return /* @__PURE__ */ jsxRuntimeExports.jsx(
client.SchemaComponent,
{
scope: { t },
components: { Alert: antd.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: true
}
}
}
},
notice: {
type: "void",
"x-component": "Alert",
"x-component-props": {
showIcon: true,
message: '{{t("The authentication allows users to sign in via username or email.")}}'
}
}
}
}
}
);
};
const AuthProvider = (props) => {
const { t } = useAuthTranslation();
return /* @__PURE__ */ jsxRuntimeExports.jsx(
client.SettingsCenterProvider,
{
settings: {
auth: {
title: t("Authentication"),
icon: "LoginOutlined",
tabs: {
authenticators: {
title: t("Authenticators"),
component: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Authenticator, {})
}
}
}
},
children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.OptionsComponentProvider, { authType: presetAuthType, component: Options, children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SigninPageProvider, { authType: presetAuthType, tabTitle: t("Sign in via password"), component: SigninPage, children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SignupPageProvider, { authType: presetAuthType, component: SignupPage, children: props.children }) }) })
}
);
};
class AuthPlugin extends client.Plugin {
async load() {
this.app.use(AuthProvider);
}
}
exports2.AuthPlugin = AuthPlugin;
exports2.default = AuthPlugin;
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
});
}}}`,"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 }}"}}},N=n=>{const{t:r}=h(),i=n.authenticator,{authType:c,name:s,options:m}=i,u=!!p.useContext(e.SignupPageContext)[c]&&(m==null?void 0:m.allowSignup),K=`/signup?authType=${c}&name=${s}`,G=()=>e.useSignIn(s);return t.jsx(e.SchemaComponent,{schema:L,scope:{useBasicSignIn:G,allowSignUp:u,signupLink:K,t:r}})},f="Email/Password",U={type:"object",name:g.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")}}'}}}}},_=n=>{const{t:r}=h(),i=()=>e.useSignup({authenticator:n.name});return t.jsx(e.SchemaComponent,{schema:U,scope:{useBasicSignup:i,t:r}})},M=()=>{const{t:n}=h();return t.jsx(e.SchemaComponent,{scope:{t:n},components:{Alert:l.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.")}}'}}}}})},z=n=>{const{t:r}=h();return t.jsx(e.SettingsCenterProvider,{settings:{auth:{title:r("Authentication"),icon:"LoginOutlined",tabs:{authenticators:{title:r("Authenticators"),component:()=>t.jsx(E,{})}}}},children:t.jsx(e.OptionsComponentProvider,{authType:f,component:M,children:t.jsx(e.SigninPageProvider,{authType:f,tabTitle:r("Sign in via password"),component:N,children:t.jsx(e.SignupPageProvider,{authType:f,component:_,children:n.children})})})})};class T extends e.Plugin{load(){return b(this,null,function*(){this.app.use(z)})}}o.AuthPlugin=T,o.default=T,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});

54

dist/index.js

@@ -1,20 +0,38 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var server = require('./server');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var server__default = /*#__PURE__*/_interopDefault(server);
Object.defineProperty(exports, 'AuthModel', {
enumerable: true,
get: function () { return server.AuthModel; }
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export(src_exports, {
AuthModel: () => import_server.AuthModel,
default: () => import_server.default
});
Object.defineProperty(exports, 'default', {
enumerable: true,
get: function () { return server__default.default; }
module.exports = __toCommonJS(src_exports);
var import_server = __toESM(require("./server"));
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AuthModel
});

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var zh_CN_exports = {};
__export(zh_CN_exports, {
default: () => zh_CN_default
});
module.exports = __toCommonJS(zh_CN_exports);
const locale = {

@@ -27,3 +47,1 @@ "Auth Type": "\u8BA4\u8BC1\u7C7B\u578B",

var zh_CN_default = locale;
module.exports = zh_CN_default;

@@ -1,1 +0,1 @@

{"name":"cron","description":"Cron jobs for your node","version":"2.3.1","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"},"dependencies":{"luxon":"^3.2.1"},"devDependencies":{"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","jest":"~29.5.x","prettier":"~2.8.x","sinon":"^15.0.x"},"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","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2023-08-27T02:25:23.030Z"}
{"name":"cron","description":"Cron jobs for your node","version":"2.3.1","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"},"dependencies":{"luxon":"^3.2.1"},"devDependencies":{"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","jest":"~29.5.x","prettier":"~2.8.x","sinon":"^15.0.x"},"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","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2023-09-03T03:43:55.836Z"}

@@ -1,11 +0,34 @@

'use strict';
var package_json = require('../package.json');
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name2 in all)
__defProp(target, name2, { get: all[name2], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var preset_exports = {};
__export(preset_exports, {
namespace: () => namespace,
presetAuthType: () => presetAuthType,
presetAuthenticator: () => presetAuthenticator
});
module.exports = __toCommonJS(preset_exports);
var import_package = require("../package.json");
const presetAuthType = "Email/Password";
const presetAuthenticator = "basic";
const namespace = package_json.name;
exports.namespace = namespace;
exports.presetAuthType = presetAuthType;
exports.presetAuthenticator = presetAuthenticator;
const namespace = import_package.name;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
namespace,
presetAuthType,
presetAuthenticator
});

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var auth_exports = {};
__export(auth_exports, {
default: () => auth_default
});
module.exports = __toCommonJS(auth_exports);
var auth_default = {

@@ -21,3 +41,1 @@ lostPassword: async (ctx, next) => {

};
module.exports = auth_default;

@@ -1,5 +0,24 @@

'use strict';
var preset = require('../../preset');
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var authenticators_exports = {};
__export(authenticators_exports, {
default: () => authenticators_default
});
module.exports = __toCommonJS(authenticators_exports);
var import_preset = require("../../preset");
async function checkCount(repository, id) {

@@ -49,3 +68,3 @@ const count = await repository.count({

} catch (err) {
ctx.throw(400, ctx.t(err.message, { ns: preset.namespace }));
ctx.throw(400, ctx.t(err.message, { ns: import_preset.namespace }));
}

@@ -67,3 +86,3 @@ const instance = await repository.destroy({

} catch (err) {
ctx.throw(400, ctx.t(err.message, { ns: preset.namespace }));
ctx.throw(400, ctx.t(err.message, { ns: import_preset.namespace }));
}

@@ -84,3 +103,1 @@ }

};
module.exports = authenticators_default;

@@ -1,12 +0,37 @@

'use strict';
var auth = require('@nocobase/auth');
var crypto = require('crypto');
var preset = require('../preset');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
class BasicAuth extends auth.BaseAuth {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var basic_auth_exports = {};
__export(basic_auth_exports, {
BasicAuth: () => BasicAuth
});
module.exports = __toCommonJS(basic_auth_exports);
var import_auth = require("@nocobase/auth");
var import_crypto = __toESM(require("crypto"));
var import_preset = require("../preset");
class BasicAuth extends import_auth.BaseAuth {
constructor(config) {

@@ -28,3 +53,3 @@ const userCollection = config.ctx.db.getCollection("users");

if (!account && !email) {
ctx.throw(400, ctx.t("Please enter your username or email", { ns: preset.namespace }));
ctx.throw(400, ctx.t("Please enter your username or email", { ns: import_preset.namespace }));
}

@@ -38,3 +63,3 @@ const filter = email ? { email } : {

if (!user) {
ctx.throw(401, ctx.t("The username or email is incorrect, please re-enter", { ns: preset.namespace }));
ctx.throw(401, ctx.t("The username or email is incorrect, please re-enter", { ns: import_preset.namespace }));
}

@@ -44,3 +69,3 @@ const field = this.userCollection.getField("password");

if (!valid) {
ctx.throw(401, ctx.t("The password is incorrect, please re-enter", { ns: preset.namespace }));
ctx.throw(401, ctx.t("The password is incorrect, please re-enter", { ns: import_preset.namespace }));
}

@@ -54,3 +79,3 @@ return user;

if (!options.allowSignUp) {
ctx.throw(403, ctx.t("Not allowed to sign up", { ns: preset.namespace }));
ctx.throw(403, ctx.t("Not allowed to sign up", { ns: import_preset.namespace }));
}

@@ -61,3 +86,3 @@ const User = ctx.db.getRepository("users");

if (!/^[^@.<>"'/]{2,16}$/.test(username)) {
ctx.throw(400, ctx.t("Please enter a valid username", { ns: preset.namespace }));
ctx.throw(400, ctx.t("Please enter a valid username", { ns: import_preset.namespace }));
}

@@ -73,3 +98,3 @@ const user = await User.create({ values });

if (!email) {
ctx.throw(400, ctx.t("Please fill in your email address", { ns: preset.namespace }));
ctx.throw(400, ctx.t("Please fill in your email address", { ns: import_preset.namespace }));
}

@@ -82,5 +107,5 @@ const user = await this.userRepository.findOne({

if (!user) {
ctx.throw(401, ctx.t("The email is incorrect, please re-enter", { ns: preset.namespace }));
ctx.throw(401, ctx.t("The email is incorrect, please re-enter", { ns: import_preset.namespace }));
}
user.resetToken = crypto__default.default.randomBytes(20).toString("hex");
user.resetToken = import_crypto.default.randomBytes(20).toString("hex");
await user.save();

@@ -139,3 +164,3 @@ return user;

if (!isValid) {
ctx.throw(401, ctx.t("The password is incorrect, please re-enter", { ns: preset.namespace }));
ctx.throw(401, ctx.t("The password is incorrect, please re-enter", { ns: import_preset.namespace }));
}

@@ -147,3 +172,5 @@ user.password = newPassword;

}
exports.BasicAuth = BasicAuth;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BasicAuth
});

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var authenticators_exports = {};
__export(authenticators_exports, {
default: () => authenticators_default
});
module.exports = __toCommonJS(authenticators_exports);
var authenticators_default = {

@@ -96,3 +116,1 @@ namespace: "auth.auth",

};
module.exports = authenticators_default;

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var token_blacklist_exports = {};
__export(token_blacklist_exports, {
default: () => token_blacklist_default
});
module.exports = __toCommonJS(token_blacklist_exports);
var token_blacklist_default = {

@@ -20,3 +40,1 @@ namespace: "auth.token-black",

};
module.exports = token_blacklist_default;

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var users_authenticators_exports = {};
__export(users_authenticators_exports, {
default: () => users_authenticators_default
});
module.exports = __toCommonJS(users_authenticators_exports);
var users_authenticators_default = {

@@ -70,3 +90,1 @@ namespace: "auth.auth",

};
module.exports = users_authenticators_default;

@@ -1,21 +0,39 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var plugin = require('./plugin');
var authenticator = require('./model/authenticator');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var plugin__default = /*#__PURE__*/_interopDefault(plugin);
Object.defineProperty(exports, 'default', {
enumerable: true,
get: function () { return plugin__default.default; }
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var server_exports = {};
__export(server_exports, {
AuthModel: () => import_authenticator.AuthModel,
default: () => import_plugin.default
});
Object.defineProperty(exports, 'AuthModel', {
enumerable: true,
get: function () { return authenticator.AuthModel; }
module.exports = __toCommonJS(server_exports);
var import_plugin = __toESM(require("./plugin"));
var import_authenticator = require("./model/authenticator");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AuthModel
});

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var en_US_exports = {};
__export(en_US_exports, {
default: () => en_US_default
});
module.exports = __toCommonJS(en_US_exports);
var en_US_default = {

@@ -11,3 +31,1 @@ "The email is incorrect, please re-enter": "The email is incorrect, please re-enter",

};
module.exports = en_US_default;

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var fr_FR_exports = {};
__export(fr_FR_exports, {
default: () => fr_FR_default
});
module.exports = __toCommonJS(fr_FR_exports);
var fr_FR_default = {

@@ -11,3 +31,1 @@ "The email is incorrect, please re-enter": "L'email est incorrect, veuillez le saisir \xE0 nouveau",

};
module.exports = fr_FR_default;

@@ -1,26 +0,43 @@

'use strict';
var enUS = require('./en-US');
var zhCN = require('./zh-CN');
var ptBR = require('./pt-BR');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var enUS__default = /*#__PURE__*/_interopDefault(enUS);
var zhCN__default = /*#__PURE__*/_interopDefault(zhCN);
var ptBR__default = /*#__PURE__*/_interopDefault(ptBR);
Object.defineProperty(exports, 'enUS', {
enumerable: true,
get: function () { return enUS__default.default; }
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var locale_exports = {};
__export(locale_exports, {
enUS: () => import_en_US.default,
ptBR: () => import_pt_BR.default,
zhCN: () => import_zh_CN.default
});
Object.defineProperty(exports, 'zhCN', {
enumerable: true,
get: function () { return zhCN__default.default; }
module.exports = __toCommonJS(locale_exports);
var import_en_US = __toESM(require("./en-US"));
var import_zh_CN = __toESM(require("./zh-CN"));
var import_pt_BR = __toESM(require("./pt-BR"));
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
enUS,
ptBR,
zhCN
});
Object.defineProperty(exports, 'ptBR', {
enumerable: true,
get: function () { return ptBR__default.default; }
});

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var ja_JP_exports = {};
__export(ja_JP_exports, {
default: () => ja_JP_default
});
module.exports = __toCommonJS(ja_JP_exports);
var ja_JP_default = {

@@ -7,3 +27,1 @@ "Please fill in your email address": "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",

};
module.exports = ja_JP_default;

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var pt_BR_exports = {};
__export(pt_BR_exports, {
default: () => pt_BR_default
});
module.exports = __toCommonJS(pt_BR_exports);
var pt_BR_default = {

@@ -11,3 +31,1 @@ "The email is incorrect, please re-enter": "O e-mail est\xE1 incorreto, por favor, digite novamente",

};
module.exports = pt_BR_default;

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var zh_CN_exports = {};
__export(zh_CN_exports, {
default: () => zh_CN_default
});
module.exports = __toCommonJS(zh_CN_exports);
var zh_CN_default = {

@@ -13,3 +33,1 @@ "The username or email is incorrect, please re-enter": "\u7528\u6237\u540D\u6216\u90AE\u7BB1\u6709\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165",

};
module.exports = zh_CN_default;

@@ -1,7 +0,26 @@

'use strict';
var server = require('@nocobase/server');
var preset = require('../../preset');
class AddBasicAuthMigration extends server.Migration {
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var basic_authenticator_exports = {};
__export(basic_authenticator_exports, {
default: () => AddBasicAuthMigration
});
module.exports = __toCommonJS(basic_authenticator_exports);
var import_server = require("@nocobase/server");
var import_preset = require("../../preset");
class AddBasicAuthMigration extends import_server.Migration {
async up() {

@@ -15,4 +34,4 @@ const repo = this.context.db.getRepository("authenticators");

values: {
name: preset.presetAuthenticator,
authType: preset.presetAuthType,
name: import_preset.presetAuthenticator,
authType: import_preset.presetAuthType,
description: "Sign in with username/email.",

@@ -26,3 +45,1 @@ enabled: true

}
module.exports = AddBasicAuthMigration;

@@ -1,7 +0,26 @@

'use strict';
var server = require('@nocobase/server');
var preset = require('../../preset');
class UpdateBasicAuthMigration extends server.Migration {
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var update_basic_exports = {};
__export(update_basic_exports, {
default: () => UpdateBasicAuthMigration
});
module.exports = __toCommonJS(update_basic_exports);
var import_server = require("@nocobase/server");
var import_preset = require("../../preset");
class UpdateBasicAuthMigration extends import_server.Migration {
async up() {

@@ -21,3 +40,3 @@ const SystemSetting = this.context.db.getRepository("systemSettings");

filter: {
name: preset.presetAuthenticator
name: import_preset.presetAuthenticator
}

@@ -29,3 +48,1 @@ });

}
module.exports = UpdateBasicAuthMigration;

@@ -1,6 +0,25 @@

'use strict';
var database = require('@nocobase/database');
class AuthModel extends database.Model {
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var authenticator_exports = {};
__export(authenticator_exports, {
AuthModel: () => AuthModel
});
module.exports = __toCommonJS(authenticator_exports);
var import_database = require("@nocobase/database");
class AuthModel extends import_database.Model {
async findUser(uuid) {

@@ -47,3 +66,5 @@ let user;

}
exports.AuthModel = AuthModel;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AuthModel
});

@@ -1,35 +0,58 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var server = require('@nocobase/server');
var path = require('path');
var preset = require('../preset');
var authActions = require('./actions/auth');
var authenticatorsActions = require('./actions/authenticators');
var basicAuth = require('./basic-auth');
var locale = require('./locale');
var authenticator = require('./model/authenticator');
var tokenBlacklist = require('./token-blacklist');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var authActions__default = /*#__PURE__*/_interopDefault(authActions);
var authenticatorsActions__default = /*#__PURE__*/_interopDefault(authenticatorsActions);
class AuthPlugin extends server.Plugin {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var plugin_exports = {};
__export(plugin_exports, {
AuthPlugin: () => AuthPlugin,
default: () => plugin_default
});
module.exports = __toCommonJS(plugin_exports);
var import_server = require("@nocobase/server");
var import_path = require("path");
var import_preset = require("../preset");
var import_auth = __toESM(require("./actions/auth"));
var import_authenticators = __toESM(require("./actions/authenticators"));
var import_basic_auth = require("./basic-auth");
var import_locale = require("./locale");
var import_authenticator = require("./model/authenticator");
var import_token_blacklist = require("./token-blacklist");
class AuthPlugin extends import_server.Plugin {
afterAdd() {
}
async beforeLoad() {
this.app.i18n.addResources("zh-CN", preset.namespace, locale.zhCN);
this.app.i18n.addResources("en-US", preset.namespace, locale.enUS);
this.app.db.registerModels({ AuthModel: authenticator.AuthModel });
this.app.i18n.addResources("zh-CN", import_preset.namespace, import_locale.zhCN);
this.app.i18n.addResources("en-US", import_preset.namespace, import_locale.enUS);
this.app.db.registerModels({ AuthModel: import_authenticator.AuthModel });
}
async load() {
await this.db.import({
directory: path.resolve(__dirname, "collections")
directory: (0, import_path.resolve)(__dirname, "collections")
});
this.db.addMigrations({
namespace: "auth",
directory: path.resolve(__dirname, "migrations"),
directory: (0, import_path.resolve)(__dirname, "migrations"),
context: {

@@ -48,12 +71,12 @@ plugin: this

if (!this.app.authManager.jwt.blacklist) {
this.app.authManager.setTokenBlacklistService(new tokenBlacklist.TokenBlacklistService(this));
this.app.authManager.setTokenBlacklistService(new import_token_blacklist.TokenBlacklistService(this));
}
this.app.authManager.registerTypes(preset.presetAuthType, {
auth: basicAuth.BasicAuth,
this.app.authManager.registerTypes(import_preset.presetAuthType, {
auth: import_basic_auth.BasicAuth,
title: "Password"
});
Object.entries(authActions__default.default).forEach(
Object.entries(import_auth.default).forEach(
([action, handler]) => this.app.resourcer.registerAction(`auth:${action}`, handler)
);
Object.entries(authenticatorsActions__default.default).forEach(
Object.entries(import_authenticators.default).forEach(
([action, handler]) => this.app.resourcer.registerAction(`authenticators:${action}`, handler)

@@ -71,3 +94,3 @@ );

const repository = this.db.getRepository("authenticators");
const exist = await repository.findOne({ filter: { name: preset.presetAuthenticator } });
const exist = await repository.findOne({ filter: { name: import_preset.presetAuthenticator } });
if (exist) {

@@ -78,4 +101,4 @@ return;

values: {
name: preset.presetAuthenticator,
authType: preset.presetAuthType,
name: import_preset.presetAuthenticator,
authType: import_preset.presetAuthType,
description: "Sign in with username/email.",

@@ -95,4 +118,5 @@ enabled: true,

var plugin_default = AuthPlugin;
exports.AuthPlugin = AuthPlugin;
exports.default = plugin_default;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AuthPlugin
});

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var token_blacklist_exports = {};
__export(token_blacklist_exports, {
TokenBlacklistService: () => TokenBlacklistService
});
module.exports = __toCommonJS(token_blacklist_exports);
class TokenBlacklistService {

@@ -39,3 +59,5 @@ constructor(plugin) {

}
exports.TokenBlacklistService = TokenBlacklistService;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TokenBlacklistService
});

@@ -1,3 +0,23 @@

'use strict';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var swagger_exports = {};
__export(swagger_exports, {
default: () => swagger_default
});
module.exports = __toCommonJS(swagger_exports);
var swagger_default = {

@@ -716,3 +736,1 @@ info: {

};
module.exports = swagger_default;
{
"name": "@nocobase/plugin-auth",
"version": "0.13.0-alpha.4",
"version": "0.13.0-alpha.5",
"main": "./dist/server/index.js",

@@ -27,3 +27,3 @@ "devDependencies": {

"description.zh-CN": "提供基础认证功能和扩展认证器管理功能",
"gitHead": "29594e9dbb2455e2f3f6bea95340c4ed75789b61"
"gitHead": "9eabe607b4a20c356fdb2fd95e40fa476986dcb0"
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc