@opengis/fastify-table 2.0.88 → 2.0.89
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/server/migrations/users.sql +3 -1
- package/dist/server/plugins/auth/funcs/authorizeUser.d.ts.map +1 -1
- package/dist/server/plugins/auth/funcs/authorizeUser.js +9 -0
- package/dist/server/plugins/migration/exec.migrations.d.ts.map +1 -1
- package/dist/server/plugins/migration/exec.migrations.js +1 -0
- package/package.json +2 -1
|
@@ -181,4 +181,6 @@ COMMENT ON COLUMN admin.user_cls.user_clsid IS 'ID';
|
|
|
181
181
|
COMMENT ON COLUMN admin.user_cls.code IS 'Код';
|
|
182
182
|
COMMENT ON COLUMN admin.user_cls.name IS 'Назва';
|
|
183
183
|
COMMENT ON COLUMN admin.user_cls.icon IS 'Іконка';
|
|
184
|
-
COMMENT ON COLUMN admin.user_cls.color IS 'Колір';
|
|
184
|
+
COMMENT ON COLUMN admin.user_cls.color IS 'Колір';
|
|
185
|
+
|
|
186
|
+
update admin.users set twofa=false where uid='1';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizeUser.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/auth/funcs/authorizeUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"authorizeUser.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/auth/funcs/authorizeUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAgCtD,wBAA8B,aAAa,CACzC,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,GAAG,EACR,QAAQ,SAAe,EACvB,MAAM,CAAC,EAAE,MAAM,gBAqIhB"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import config from "../../../../config.js";
|
|
2
2
|
import logger from "../../logger/getLogger.js";
|
|
3
3
|
import pgClients from "../../pg/pgClients.js";
|
|
4
|
+
import getRedis from "../../redis/funcs/getRedis.js";
|
|
4
5
|
import applyHook from "../../hook/applyHook.js";
|
|
5
6
|
import logAuth from "./logAuth.js";
|
|
7
|
+
const rclient = getRedis();
|
|
8
|
+
const rclient2 = getRedis({ db: 2 });
|
|
6
9
|
/*
|
|
7
10
|
session duration by default
|
|
8
11
|
* 10 hours = 600 minutes w/o keep (remember me checkbox)
|
|
@@ -59,6 +62,12 @@ export default async function authorizeUser(user, req, authType = "creds-user",
|
|
|
59
62
|
const redirectUrl = req.headers?.referer?.match?.(/[?&]redirect=([^&]+)/)?.[1] || "/";
|
|
60
63
|
const twofaEnabled = user?.twofa && user.uid && pg;
|
|
61
64
|
const registered = false; // ? check by created/updated date?
|
|
65
|
+
if (config.auth?.oneUser || true) {
|
|
66
|
+
const userSessionKey = `${config.pg?.database}:user:${user.uid}`;
|
|
67
|
+
const sessionID = await rclient.get(userSessionKey);
|
|
68
|
+
await rclient2.del(`session_auth:${config.pg?.database}:${sessionID}`);
|
|
69
|
+
await rclient?.set?.(userSessionKey, req.session.sessionId);
|
|
70
|
+
}
|
|
62
71
|
if (req.method === "POST" &&
|
|
63
72
|
(!twofaEnabled || req.session?.secondFactorPassed)) {
|
|
64
73
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.migrations.d.ts","sourceRoot":"","sources":["../../../../server/plugins/migration/exec.migrations.ts"],"names":[],"mappings":"AAWA,wBAA8B,cAAc,CAC1C,OAAO,EAAE,GAAG,EACZ,EAAE,MAAmB,EACrB,MAAM,UAAQ,
|
|
1
|
+
{"version":3,"file":"exec.migrations.d.ts","sourceRoot":"","sources":["../../../../server/plugins/migration/exec.migrations.ts"],"names":[],"mappings":"AAWA,wBAA8B,cAAc,CAC1C,OAAO,EAAE,GAAG,EACZ,EAAE,MAAmB,EACrB,MAAM,UAAQ,mBAgEf"}
|
|
@@ -26,6 +26,7 @@ export default async function execMigrations(dirPath, pg = pgClients.client, isc
|
|
|
26
26
|
return txt;
|
|
27
27
|
}
|
|
28
28
|
if (process.env.NODE_ENV !== "production" &&
|
|
29
|
+
!process.env.MIGRATE &&
|
|
29
30
|
!(iscore ? config.migrationsCore : config.migrations)) {
|
|
30
31
|
const txt = `migrations skip: not a production environment - ${iscore ? "core" : "path"} : ${dirPath}`;
|
|
31
32
|
if (debug)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengis/fastify-table",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.89",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "core-plugins",
|
|
6
6
|
"keywords": [
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"clean": "tsc -b --clean",
|
|
26
26
|
"build": "tsc -b --clean && tsc && copyfiles server/plugins/grpc/utils/*.proto dist && copyfiles server/migrations/*.sql dist && copyfiles server/templates/**/*.html dist && copyfiles server/templates/**/*.hbs dist",
|
|
27
27
|
"prod": "NODE_ENV=production bun dist/server",
|
|
28
|
+
"migrate": "MIGRATE=true bun script/migrate",
|
|
28
29
|
"patch": "npm version patch && git push && npm publish",
|
|
29
30
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
30
31
|
"test": "bun test",
|