mbkauthe 4.7.0 → 4.7.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/docs/db.sql CHANGED
@@ -138,7 +138,10 @@ INSERT INTO "Users" ("UserName", "Password", "Role", "Active", "HaveMailAccount"
138
138
  VALUES ('support', '12345678', 'SuperAdmin', true, false, 'Support User')
139
139
  ON CONFLICT ("UserName") DO NOTHING;
140
140
 
141
- SELECT * FROM "Users" WHERE "UserName" = 'support';
141
+ INSERT INTO "Users" ("UserName", "Password", "Role", "Active", "HaveMailAccount", "FullName")
142
+ VALUES ('admin', '12345678', 'SuperAdmin', true, false, 'Admin User')
143
+ ON CONFLICT ("UserName") DO NOTHING;
144
+
142
145
 
143
146
  -- API Tokens for persistent programmatic access
144
147
  CREATE TABLE IF NOT EXISTS "ApiTokens" (
package/index.js CHANGED
@@ -5,6 +5,7 @@ import { engine } from "express-handlebars";
5
5
  import path from "path";
6
6
  import { fileURLToPath } from "url";
7
7
  import { renderError, renderPage } from "#response.js";
8
+ import { packageJson } from "#config.js";
8
9
 
9
10
  const __filename = fileURLToPath(import.meta.url);
10
11
  const __dirname = path.dirname(__filename);
@@ -43,6 +44,9 @@ app.engine("handlebars", engine({
43
44
  return []; // Return an empty array if obj is undefined, null, or not an object
44
45
  }
45
46
  return Object.entries(obj).map(([key, value]) => ({ key, value }));
47
+ },
48
+ cacheBuster: function () {
49
+ return packageJson.version;
46
50
  }
47
51
  }
48
52
 
@@ -2,7 +2,7 @@ import express from "express";
2
2
  import fetch from 'node-fetch';
3
3
  import rateLimit from 'express-rate-limit';
4
4
  import { mbkautheVar, packageJson, appVersion } from "#config.js";
5
- import { renderError } from "#response.js";
5
+ import { renderError, renderPage } from "#response.js";
6
6
  import { authenticate, validateSession, validateSessionAndRole } from "../middleware/auth.js";
7
7
  import { ErrorCodes, ErrorMessages, createErrorResponse } from "../utils/errors.js";
8
8
  import { dblogin } from "#pool.js";
@@ -187,8 +187,7 @@ router.get(['/test', '/'], validateSession, LoginLimit, async (req, res) => {
187
187
  ? new Date(req.session.cookie.expires).toISOString()
188
188
  : null;
189
189
 
190
- return res.render('pages/test.handlebars', {
191
- layout: false,
190
+ return renderPage(req, res, 'pages/test.handlebars', false, {
192
191
  username,
193
192
  fullname: fullname || 'N/A',
194
193
  role,
@@ -439,8 +438,7 @@ router.get("/ErrorCode", (req, res) => {
439
438
  }))
440
439
  })).filter(category => category.errors.length > 0); // Remove empty categories
441
440
 
442
- res.render("errorCodes.handlebars", {
443
- layout: false,
441
+ return renderPage(req, res, "pages/errorCodes.handlebars", false, {
444
442
  pageTitle: 'Error Codes',
445
443
  appName: mbkautheVar.APP_NAME,
446
444
  errorCategories: categoriesWithErrors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mbkauthe",
3
- "version": "4.7.0",
3
+ "version": "4.7.1",
4
4
  "description": "MBKTech's reusable authentication system for Node.js applications.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -53,20 +53,49 @@
53
53
  "registry": "https://registry.npmjs.org/"
54
54
  },
55
55
  "dependencies": {
56
+ "bytes": "^3.1.2",
56
57
  "connect-pg-simple": "^10.0.0",
58
+ "content-type": "^1.0.5",
59
+ "cookie": "^1.1.1",
57
60
  "cookie-parser": "^1.4.7",
58
61
  "csurf": "^1.2.2",
59
- "dotenv": "^16.4.7",
62
+ "debug": "^4.4.3",
63
+ "depd": "^2.0.0",
64
+ "dotenv": "^16.6.1",
65
+ "encodeurl": "^2.0.0",
66
+ "escape-html": "^1.0.3",
67
+ "etag": "^1.8.1",
60
68
  "express": "^5.1.0",
61
69
  "express-handlebars": "^8.0.1",
62
70
  "express-rate-limit": "^7.5.0",
63
71
  "express-session": "^1.18.1",
72
+ "graceful-fs": "^4.2.11",
73
+ "iconv-lite": "^0.7.2",
74
+ "inherits": "^2.0.4",
75
+ "ms": "^2.1.3",
64
76
  "node-fetch": "^3.3.2",
77
+ "on-finished": "^2.4.1",
78
+ "once": "^1.4.0",
79
+ "parseurl": "^1.3.3",
65
80
  "passport": "^0.7.0",
66
81
  "passport-github2": "^0.1.12",
67
82
  "passport-google-oauth20": "^2.0.0",
68
83
  "pg": "^8.14.1",
69
- "speakeasy": "^2.0.0"
84
+ "proxy-addr": "^2.0.7",
85
+ "qs": "^6.15.0",
86
+ "range-parser": "^1.2.1",
87
+ "safe-buffer": "^5.2.1",
88
+ "speakeasy": "^2.0.0",
89
+ "statuses": "^2.0.2",
90
+ "unpipe": "^1.0.0",
91
+ "utils-merge": "^1.0.1",
92
+ "vary": "^1.1.2",
93
+ "xtend": "^4.0.2"
94
+ },
95
+ "overrides": {
96
+ "csurf": {
97
+ "cookie": "^0.7.0"
98
+ }
70
99
  },
71
100
  "devDependencies": {
72
101
  "@types/express": "^5.0.6",
@@ -84,4 +113,4 @@
84
113
  "testTimeout": 10000,
85
114
  "transform": {}
86
115
  }
87
- }
116
+ }