@tachybase/module-auth 1.5.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +6 -6
- package/dist/node_modules/cron/package.json +1 -1
- package/dist/node_modules/ms/package.json +1 -1
- package/dist/server/actions/auth.js +2 -2
- package/dist/server/actions/authenticators.js +2 -2
- package/dist/server/basic-auth.js +6 -2
- package/dist/server/collections/.gitkeep +0 -0
- package/dist/server/plugin.js +1 -2
- package/dist/server/token-blacklist.d.ts +1 -1
- package/package.json +7 -7
package/dist/client/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
width: 100%;
|
|
5
5
|
left: 0;
|
|
6
6
|
text-align: center;
|
|
7
|
-
`,children:c.jsx(i.PoweredBy,{})})]})}const Ze=()=>{var n;const o=i.usePlugin(_).authTypes.getEntities(),t={};for(const[r,s]of o)(n=s.components)!=null&&n.SignInForm&&(t[r]=s.components.SignInForm);return t},Je=(e=[])=>{var s;const t=i.usePlugin(_).authTypes.getEntities(),n={};for(const[a,u]of t)(s=u.components)!=null&&s.SignInButton&&(n[a]=u.components.SignInButton);const r=Object.keys(n);return e.filter(a=>r.includes(a.authType)).map((a,u)=>f.createElement(n[a.authType],{key:u,authenticator:a}))},Qe=()=>{const{t:e}=w();i.useCurrentDocumentTitle("Signin"),i.useViewport();const o=Ze(),t=f.useContext(j),n=Je(t);if(!t.length)return c.jsx("div",{style:{color:"#ccc"},children:e("No authentication methods available.")});const r=t.map(s=>{const a=o[s.authType];if(!a)return;const u=`${e("Sign-in")} (${e(s.authTypeTitle||s.authType)})`;return E({component:f.createElement(a,{authenticator:s}),tabTitle:s.title||s.name==="basic"?u:`${e(s.name)}`},s)}).filter(s=>s);return c.jsxs(x.Space,{direction:"vertical",className:i.css`
|
|
7
|
+
`,children:c.jsx(i.PoweredBy,{})})]})}const Ze=()=>{var n;const o=i.usePlugin(_).authTypes.getEntities(),t={};for(const[r,s]of o)(n=s.components)!=null&&n.SignInForm&&(t[r]=s.components.SignInForm);return t},Je=(e=[])=>{var s;const t=i.usePlugin(_).authTypes.getEntities(),n={};for(const[a,u]of t)(s=u.components)!=null&&s.SignInButton&&(n[a]=u.components.SignInButton);const r=Object.keys(n);return Array.isArray(e)?e.filter(a=>r.includes(a.authType)).map((a,u)=>f.createElement(n[a.authType],{key:u,authenticator:a})):(console.error("[useSignInButtons] authenticators is not an array:",{type:typeof e,value:e}),[])},Qe=()=>{const{t:e}=w();i.useCurrentDocumentTitle("Signin"),i.useViewport();const o=Ze(),t=f.useContext(j),n=Je(t);if(!t.length)return c.jsx("div",{style:{color:"#ccc"},children:e("No authentication methods available.")});const r=t.map(s=>{const a=o[s.authType];if(!a)return;const u=`${e("Sign-in")} (${e(s.authTypeTitle||s.authType)})`;return E({component:f.createElement(a,{authenticator:s}),tabTitle:s.title||s.name==="basic"?u:`${e(s.name)}`},s)}).filter(s=>s);return c.jsxs(x.Space,{direction:"vertical",className:i.css`
|
|
8
8
|
display: flex;
|
|
9
9
|
`,children:[r.length>1?c.jsx(x.Tabs,{items:r.map(s=>({label:s.tabTitle,key:s.name,children:s.component}))}):r.length?c.jsx("div",{children:r[0].component}):c.jsx(c.Fragment,{}),c.jsx(x.Space,{direction:"vertical",className:i.css`
|
|
10
10
|
display: flex;
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.
|
|
3
|
+
"@tachybase/client": "1.6.1",
|
|
4
4
|
"react-router-dom": "6.28.1",
|
|
5
|
-
"@tego/client": "1.
|
|
5
|
+
"@tego/client": "1.6.0-alpha.9",
|
|
6
6
|
"axios": "1.13.0",
|
|
7
7
|
"lodash": "4.17.21",
|
|
8
|
-
"@tego/server": "1.
|
|
9
|
-
"@tachybase/test": "1.
|
|
8
|
+
"@tego/server": "1.6.0-alpha.9",
|
|
9
|
+
"@tachybase/test": "1.6.0-alpha.9",
|
|
10
10
|
"antd": "5.22.5",
|
|
11
|
-
"@tachybase/schema": "1.
|
|
11
|
+
"@tachybase/schema": "1.6.0-alpha.9",
|
|
12
12
|
"react-i18next": "16.2.1",
|
|
13
|
-
"@ant-design/icons": "
|
|
13
|
+
"@ant-design/icons": "6.1.0"
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron","description":"Cron jobs for your node","version":"3.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":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -b tsconfig.build.json","lint:eslint":"eslint src/ tests/","lint:prettier":"prettier ./**/*.{json,md,yml} --check","lint":"npm run lint:eslint && npm run lint:prettier","lint:fix":"npm run lint:eslint -- --fix && npm run lint:prettier -- --write","test":"jest --coverage","test:watch":"jest --watch --coverage","test:fuzz":"jest --testMatch='**/*.fuzz.ts' --coverage=false --testTimeout=120000","prepare":"husky"},"dependencies":{"@types/luxon":"~3.4.0","luxon":"~3.5.0"},"devDependencies":{"@commitlint/cli":"19.6.0","@eslint/js":"^9.14.0","@fast-check/jest":"2.0.3","@insurgent/commitlint-config":"20.0.0","@insurgent/conventional-changelog-preset":"10.0.0","@semantic-release/changelog":"6.0.3","@semantic-release/commit-analyzer":"13.0.0","@semantic-release/git":"10.0.1","@semantic-release/github":"11.0.1","@semantic-release/npm":"12.0.1","@semantic-release/release-notes-generator":"14.0.1","@types/jest":"29.5.14","@types/node":"20.17.9","@types/sinon":"17.0.3","chai":"4.5.0","eslint":"8.57.1","eslint-config-prettier":"9.1.0","eslint-plugin-jest":"27.9.0","eslint-plugin-prettier":"5.2.1","husky":"9.1.7","jest":"29.7.0","lint-staged":"15.2.10","prettier":"3.3.3","semantic-release":"24.2.0","sinon":"17.0.2","ts-jest":"29.2.5","typescript":"5.7.2","typescript-eslint":"^7.2.0"},"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)","Pierre Cavin <me@sherlox.io> (https://github.com/sheerlox)","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)"],"files":["dist/**/*.js","dist/**/*.d.ts","CHANGELOG.md","LICENSE","README.md"],"lint-staged":{"*.ts":"eslint src/ tests/ --fix","*.{json,md,yml}":"prettier ./**/*.{json,md,yml} --check --write"},"_lastModified":"2025-
|
|
1
|
+
{"name":"cron","description":"Cron jobs for your node","version":"3.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":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -b tsconfig.build.json","lint:eslint":"eslint src/ tests/","lint:prettier":"prettier ./**/*.{json,md,yml} --check","lint":"npm run lint:eslint && npm run lint:prettier","lint:fix":"npm run lint:eslint -- --fix && npm run lint:prettier -- --write","test":"jest --coverage","test:watch":"jest --watch --coverage","test:fuzz":"jest --testMatch='**/*.fuzz.ts' --coverage=false --testTimeout=120000","prepare":"husky"},"dependencies":{"@types/luxon":"~3.4.0","luxon":"~3.5.0"},"devDependencies":{"@commitlint/cli":"19.6.0","@eslint/js":"^9.14.0","@fast-check/jest":"2.0.3","@insurgent/commitlint-config":"20.0.0","@insurgent/conventional-changelog-preset":"10.0.0","@semantic-release/changelog":"6.0.3","@semantic-release/commit-analyzer":"13.0.0","@semantic-release/git":"10.0.1","@semantic-release/github":"11.0.1","@semantic-release/npm":"12.0.1","@semantic-release/release-notes-generator":"14.0.1","@types/jest":"29.5.14","@types/node":"20.17.9","@types/sinon":"17.0.3","chai":"4.5.0","eslint":"8.57.1","eslint-config-prettier":"9.1.0","eslint-plugin-jest":"27.9.0","eslint-plugin-prettier":"5.2.1","husky":"9.1.7","jest":"29.7.0","lint-staged":"15.2.10","prettier":"3.3.3","semantic-release":"24.2.0","sinon":"17.0.2","ts-jest":"29.2.5","typescript":"5.7.2","typescript-eslint":"^7.2.0"},"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)","Pierre Cavin <me@sherlox.io> (https://github.com/sheerlox)","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)"],"files":["dist/**/*.js","dist/**/*.d.ts","CHANGELOG.md","LICENSE","README.md"],"lint-staged":{"*.ts":"eslint src/ tests/ --fix","*.{json,md,yml}":"prettier ./**/*.{json,md,yml} --check --write"},"_lastModified":"2025-12-05T07:09:26.013Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2025-
|
|
1
|
+
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2025-12-05T07:09:26.116Z"}
|
|
@@ -36,10 +36,10 @@ var auth_default = {
|
|
|
36
36
|
changePassword: async (ctx, next) => {
|
|
37
37
|
var _a, _b;
|
|
38
38
|
if (((_b = (_a = ctx.action.params) == null ? void 0 : _a.values) == null ? void 0 : _b.verifyMethod) === "code") {
|
|
39
|
-
const auth = await ctx.
|
|
39
|
+
const auth = await ctx.tego.authManager.get("sms", ctx);
|
|
40
40
|
ctx.body = await auth.changePassword();
|
|
41
41
|
} else {
|
|
42
|
-
const auth = await ctx.
|
|
42
|
+
const auth = await ctx.tego.authManager.get("Email/Password", ctx);
|
|
43
43
|
ctx.body = await auth.changePassword();
|
|
44
44
|
}
|
|
45
45
|
await next();
|
|
@@ -36,12 +36,12 @@ async function checkCount(repository, id) {
|
|
|
36
36
|
}
|
|
37
37
|
var authenticators_default = {
|
|
38
38
|
listTypes: async (ctx, next) => {
|
|
39
|
-
ctx.body = ctx.
|
|
39
|
+
ctx.body = ctx.tego.authManager.listTypes();
|
|
40
40
|
await next();
|
|
41
41
|
},
|
|
42
42
|
publicList: async (ctx, next) => {
|
|
43
43
|
const repo = ctx.db.getRepository("authenticators");
|
|
44
|
-
const authManager = ctx.
|
|
44
|
+
const authManager = ctx.tego.authManager;
|
|
45
45
|
const authenticators = await repo.find({
|
|
46
46
|
fields: ["name", "authType", "title", "options", "sort"],
|
|
47
47
|
filter: {
|
|
@@ -161,7 +161,7 @@ class BasicAuth extends import_server.BaseAuth {
|
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
const pwd = this.userCollection.getField("password");
|
|
164
|
-
const verificationPlugin = ctx.
|
|
164
|
+
const verificationPlugin = ctx.tego.getPlugin("otp");
|
|
165
165
|
if (user.password !== null) {
|
|
166
166
|
const isValid = await pwd.verify(oldPassword, user.password);
|
|
167
167
|
if (!isValid) {
|
|
@@ -169,8 +169,12 @@ class BasicAuth extends import_server.BaseAuth {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
if (code && phone) {
|
|
172
|
+
const verificationPlugin2 = ctx.tego.pm.get("otp");
|
|
173
|
+
if (!verificationPlugin2) {
|
|
174
|
+
ctx.throw(500, "Verification plugin not found");
|
|
175
|
+
}
|
|
172
176
|
try {
|
|
173
|
-
await
|
|
177
|
+
await verificationPlugin2.intercept(ctx, async () => {
|
|
174
178
|
});
|
|
175
179
|
} catch (e) {
|
|
176
180
|
ctx.throw(401, ctx.t("The verification code is incorrect or expired", { ns: import_preset.namespace }));
|
|
File without changes
|
package/dist/server/plugin.js
CHANGED
|
@@ -53,7 +53,7 @@ class PluginAuthServer extends import_server.Plugin {
|
|
|
53
53
|
name: "auth-token-controller",
|
|
54
54
|
prefix: "auth-token-controller"
|
|
55
55
|
});
|
|
56
|
-
const tokenController = new import_token_controller.TokenController({ cache, app: this.app, logger: this.app.
|
|
56
|
+
const tokenController = new import_token_controller.TokenController({ cache, app: this.app, logger: this.app.logger });
|
|
57
57
|
this.app.authManager.setTokenControlService(tokenController);
|
|
58
58
|
const tokenPolicyRepo = this.app.db.getRepository(import_constants.tokenPolicyCollectionName);
|
|
59
59
|
try {
|
|
@@ -162,7 +162,6 @@ class PluginAuthServer extends import_server.Plugin {
|
|
|
162
162
|
db: this.app.db,
|
|
163
163
|
cache: this.app.cache,
|
|
164
164
|
logger: this.app.logger,
|
|
165
|
-
log: this.app.log,
|
|
166
165
|
throw: (...args) => {
|
|
167
166
|
throw new Error(...args);
|
|
168
167
|
},
|
|
@@ -8,7 +8,7 @@ export declare class TokenBlacklistService implements ITokenBlacklistService {
|
|
|
8
8
|
bloomFilter: BloomFilter;
|
|
9
9
|
cacheKey: string;
|
|
10
10
|
constructor(plugin: AuthPlugin);
|
|
11
|
-
get app(): import("@tego/server").Application
|
|
11
|
+
get app(): import("@tego/server").Application;
|
|
12
12
|
has(token: string): Promise<boolean>;
|
|
13
13
|
add(values: any): Promise<[import("@tego/server").Model<any, any>, boolean]>;
|
|
14
14
|
deleteExpiredTokens(): Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-auth",
|
|
3
3
|
"displayName": "Authentication",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Authentication",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"main": "./dist/server/index.js",
|
|
11
11
|
"dependencies": {},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@ant-design/icons": "^
|
|
14
|
-
"@tachybase/schema": "1.
|
|
15
|
-
"@tachybase/test": "1.
|
|
16
|
-
"@tego/client": "1.
|
|
17
|
-
"@tego/server": "1.
|
|
13
|
+
"@ant-design/icons": "^6.1.0",
|
|
14
|
+
"@tachybase/schema": "1.6.0-alpha.9",
|
|
15
|
+
"@tachybase/test": "1.6.0-alpha.9",
|
|
16
|
+
"@tego/client": "1.6.0-alpha.9",
|
|
17
|
+
"@tego/server": "1.6.0-alpha.9",
|
|
18
18
|
"antd": "5.22.5",
|
|
19
19
|
"axios": "1.13.0",
|
|
20
20
|
"cron": "^3.3.1",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react": "18.3.1",
|
|
24
24
|
"react-i18next": "16.2.1",
|
|
25
25
|
"react-router-dom": "6.28.1",
|
|
26
|
-
"@tachybase/client": "1.
|
|
26
|
+
"@tachybase/client": "1.6.1"
|
|
27
27
|
},
|
|
28
28
|
"description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
|
|
29
29
|
"displayName.zh-CN": "用户认证",
|