mbkauthe 4.3.3 → 4.5.0

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
@@ -50,7 +50,7 @@ CREATE TABLE "Users" (
50
50
 
51
51
  "FullName" VARCHAR(255),
52
52
  "email" TEXT DEFAULT 'support@mbktech.org',
53
- "Image" TEXT DEFAULT 'https://portal.mbktech.org/icon.svg',
53
+ "Image" TEXT DEFAULT 'https://portal.mbktech.org/Assets/Images/M.png',
54
54
  "Bio" TEXT DEFAULT 'I am ....',
55
55
  "SocialAccounts" TEXT DEFAULT '{}',
56
56
  "Positions" jsonb DEFAULT '{"Not_Permanent":"Member Is Not Permanent"}',
package/lib/main.js CHANGED
@@ -64,9 +64,9 @@ router.get(["/login", "/signin"], async (req, res) => {
64
64
  return res.redirect(redirectUrl);
65
65
  });
66
66
 
67
- router.get('/icon.svg', (req, res) => {
67
+ router.get(['/icon.svg',"/favicon.ico"], (req, res) => {
68
68
  res.setHeader('Cache-Control', 'public, max-age=31536000');
69
- res.sendFile(path.join(__dirname, '..', 'public', 'icon.svg'));
69
+ res.sendFile(path.join(__dirname, '..', 'public', 'M.png'));
70
70
  });
71
71
 
72
72
  export { getLatestVersion } from "./routes/misc.js";
@@ -62,8 +62,8 @@ router.get("/bg.webp", (req, res) => {
62
62
  router.get('/user/profilepic', async (req, res) => {
63
63
  // Helper function to serve default icon
64
64
  const serveDefaultIcon = () => {
65
- const iconPath = path.join(__dirname, "..", "..", "public", "icon.svg");
66
- res.setHeader('Content-Type', 'image/svg+xml');
65
+ const iconPath = path.join(__dirname, "..", "..", "public", "M.png");
66
+ res.setHeader('Content-Type', 'image/png');
67
67
  // Ensure we don't override the Cache-Control we set earlier, or set a default if not set
68
68
  if (!res.getHeader('Cache-Control')) {
69
69
  res.setHeader('Cache-Control', 'private, no-cache');
@@ -189,7 +189,7 @@ router.get('/test', validateSession, LoginLimit, async (req, res) => {
189
189
  <div>
190
190
  <div class="status">✅ Authentication successful</div>
191
191
  <h3 class="user-title">${req.session.user.username} <small style="color:var(--muted);font-weight:600">· ${req.session.user.role}</small></h3>
192
- <p class="user-sub">ID: ${req.session.user.id} · Session: ${req.session.user.sessionId.slice(0,8)}…</p>
192
+ <p class="user-sub">ID: ${req.session.user.id} · Session: ${req.session.user.sessionId.slice(0, 8)}…</p>
193
193
  </div>
194
194
 
195
195
  <div class="details" aria-live="polite">
@@ -476,15 +476,13 @@ export async function getLatestVersion() {
476
476
  }
477
477
  }
478
478
 
479
+
480
+ const { APP_NAME, DOMAIN, IS_DEPLOYED, loginRedirectURL } = mbkautheVar;
481
+ const safe_mbkautheVar = { APP_NAME, DOMAIN, IS_DEPLOYED, loginRedirectURL };
482
+
479
483
  // Info page
480
484
  router.get(["/info", "/i"], LoginLimit, async (req, res) => {
481
485
  let latestVersion;
482
- const parameters = req.query;
483
- let authorized = false;
484
-
485
- if (parameters.password && mbkautheVar.Main_SECRET_TOKEN) {
486
- authorized = String(parameters.password) === String(mbkautheVar.Main_SECRET_TOKEN);
487
- }
488
486
 
489
487
  try {
490
488
  latestVersion = await getLatestVersion();
@@ -493,13 +491,12 @@ router.get(["/info", "/i"], LoginLimit, async (req, res) => {
493
491
  }
494
492
 
495
493
  try {
496
- res.render("info.handlebars", {
494
+ res.render("info_mbkauthe.handlebars", {
497
495
  layout: false,
498
- mbkautheVar: mbkautheVar,
499
- version: packageJson.version,
496
+ mbkautheVar: safe_mbkautheVar,
497
+ CurrentVersion: packageJson.version,
500
498
  APP_VERSION: appVersion,
501
- latestVersion,
502
- authorized: authorized,
499
+ latestVersion
503
500
  });
504
501
  } catch (err) {
505
502
  console.error("[mbkauthe] Error fetching version information:", err);
@@ -517,6 +514,22 @@ router.get(["/info", "/i"], LoginLimit, async (req, res) => {
517
514
  }
518
515
  });
519
516
 
517
+ router.get(["/info.json", "/i.json"], LoginLimit, async (req, res) => {
518
+ let latestVersion;
519
+ try {
520
+ latestVersion = await getLatestVersion();
521
+ } catch (err) {
522
+ console.error("[mbkauthe] Error fetching package-lock.json:", err);
523
+ }
524
+
525
+ try {
526
+ res.json({ mbkautheVar: safe_mbkautheVar, CurrentVersion: packageJson.version, APP_VERSION: appVersion, latestVersion });
527
+ } catch (err) {
528
+ console.error("[mbkauthe] Error fetching version information:", err);
529
+ res.status(500).json({ success: false, message: "Failed to fetch version information" });
530
+ }
531
+ });
532
+
520
533
  // Terminate all sessions (admin endpoint)
521
534
  router.post("/api/terminateAllSessions", AdminOperationLimit, authenticate(mbkautheVar.Main_SECRET_TOKEN), async (req, res) => {
522
535
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mbkauthe",
3
- "version": "4.3.3",
3
+ "version": "4.5.0",
4
4
  "description": "MBKTech's reusable authentication system for Node.js applications.",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/public/M.png ADDED
Binary file
Binary file
@@ -16,7 +16,10 @@
16
16
  <div class="login-sidebar">
17
17
  <div class="sidebar-content">
18
18
  <div class="brand-section">
19
- <img width="50px" height="50px" src="/icon.svg" alt="MBKAuthe Logo" class="brand-logo" />
19
+ <div class="logo" style="justify-content: center;margin-bottom: 1rem;">
20
+ <img src="/icon.svg" alt="Logo" class="logo-image">
21
+ <span class="logo-text">BK <span>Tech</span></span>
22
+ </div>
20
23
  <h2 class="brand-title">Welcome to MBKAuthe</h2>
21
24
  <p class="brand-description">Secure authentication for MBKTech.org services</p>
22
25
  </div>
@@ -167,7 +170,7 @@
167
170
  justify-content: center;
168
171
  font-weight: 600;
169
172
  font-size: 18px;
170
- background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
173
+ background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
171
174
  }
172
175
 
173
176
  .account-info {
@@ -2,8 +2,8 @@
2
2
  <div class="header-container">
3
3
  <a class="logo">
4
4
  <img src="/icon.svg" alt="Logo" class="logo-image"/>
5
- <span class="logo-text">{{#if appName}}{{appName}}{{else}}{{#if app}}{{app}}{{else}}mbkauthe{{/if}}{{/if}}
6
- <span class="logo-comp">mbktech</span></span>
5
+ <span class="logo-text">BK <span>Tech</span></span>
6
+ <span class="logo-comp">{{#if appName}}{{appName}}{{else}}{{#if app}}{{app}}{{else}}mbkauthe{{/if}}{{/if}}
7
7
  </a>
8
8
 
9
9
  {{> profilemenu}}
@@ -180,13 +180,13 @@
180
180
  <h2><i class="fas fa-code-branch"></i> Version Information</h2>
181
181
  <div class="info-row">
182
182
  <div class="info-label">Current Version:</div>
183
- <div class="info-value" id="CurrentVersion">{{version}}</div>
183
+ <div class="info-value" id="CurrentVersion">{{CurrentVersion}}</div>
184
184
  </div>
185
185
  <div class="info-row">
186
186
  <div class="info-label">Latest Version:</div>
187
187
  <div class="info-value">
188
188
  {{latestVersion}}
189
- {{#if (eq latestVersion version)}}
189
+ {{#if (eq latestVersion CurrentVersion)}}
190
190
  <span class="version-status version-up-to-date">
191
191
  <i class="fas fa-check-circle"></i> Up to date
192
192
  </span>
@@ -206,7 +206,7 @@
206
206
  <div class="info-value">{{APP_VERSION}}</div>
207
207
  </div>
208
208
  <div class="info-row">
209
- <div class="info-label">Domain:</div>
209
+ <div class="info-label">DOMAIN:</div>
210
210
  <div class="info-value">{{mbkautheVar.DOMAIN}}</div>
211
211
  </div>
212
212
  <div class="info-row">
@@ -26,7 +26,7 @@
26
26
  background: var(--accent);
27
27
  color: #fff;
28
28
  border-radius: 999px;
29
- border: 2px solid rgba(0, 0, 0, 0.15);
29
+ border: 2px solid rgb(0 0 0 / 52%);
30
30
  z-index: 30;
31
31
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
32
32
  line-height: 1;
@@ -81,7 +81,10 @@
81
81
  <div class="login-sidebar">
82
82
  <div class="sidebar-content">
83
83
  <div class="brand-section">
84
- <img width="50px" height="50px" src="/icon.svg" alt="MBKAuthe Logo" class="brand-logo" />
84
+ <div class="logo" style="justify-content: center;margin-bottom: 1rem;">
85
+ <img src="/icon.svg" alt="Logo" class="logo-image">
86
+ <span class="logo-text">BK <span>Tech</span></span>
87
+ </div>
85
88
  <h2 class="brand-title">Welcome to MBKAuthe</h2>
86
89
  <p class="brand-description">Secure authentication for MBKTech.org services</p>
87
90
  </div>
@@ -92,7 +95,7 @@
92
95
  <i class="fab fa-github"></i>
93
96
  <span>Continue with GitHub</span>
94
97
  {{#if lastLoginGithub}}<span class="last-used-badge" aria-hidden="true"
95
- title="Last used">Last Used</span>{{/if}}
98
+ title="Last used">Last</span>{{/if}}
96
99
  </a>
97
100
  {{/if}}
98
101
  {{#if googleLoginEnabled }}
@@ -100,7 +103,7 @@
100
103
  <i class="fab fa-google"></i>
101
104
  <span>Continue with Google</span>
102
105
  {{#if lastLoginGoogle}}<span class="last-used-badge" aria-hidden="true"
103
- title="Last used">Last Used</span>{{/if}}
106
+ title="Last used">Last</span>{{/if}}
104
107
  </a>
105
108
  {{/if}}
106
109
  <a href="/mbkauthe/accounts" id="switchacc" class="btn-social btn-switch-side">
@@ -156,7 +159,7 @@
156
159
  <button type="submit" class="btn-login last-used-parent" id="loginButton">
157
160
  <span id="loginButtonText">Login</span>
158
161
  {{#if lastLoginPassword}}<span class="last-used-badge" aria-hidden="true"
159
- title="Last used">Last Used</span>{{/if}}
162
+ title="Last used">Last</span>{{/if}}
160
163
  </button>
161
164
  {{#if userLoggedIn }}
162
165
  <div class="WarningboxInfo already-logged-info">
@@ -182,13 +185,13 @@
182
185
  title="Continue with GitHub">
183
186
  <i class="fab fa-github"></i>
184
187
  {{#if lastLoginGithub}}<span class="last-used-badge" aria-hidden="true"
185
- title="Last used">Last Used</span>{{/if}}
188
+ title="Last used">Last</span>{{/if}}
186
189
  </a>
187
190
  <a type="button" class="swi s mobile-google-btn last-used-parent"
188
191
  title="Continue with Google">
189
192
  <i class="fab fa-google"></i>
190
193
  {{#if lastLoginGoogle}}<span class="last-used-badge" aria-hidden="true"
191
- title="Last used">Last Used</span>{{/if}}
194
+ title="Last used">Last</span>{{/if}}
192
195
  </a>
193
196
  </div>
194
197
  </div>
@@ -56,7 +56,7 @@
56
56
  .logo {
57
57
  display: flex;
58
58
  align-items: center;
59
- gap: .75rem;
59
+ gap: .3rem;
60
60
  text-decoration: none;
61
61
  }
62
62
 
@@ -67,7 +67,7 @@
67
67
  }
68
68
 
69
69
  .logo-text {
70
- font-size: 1.5rem;
70
+ font-size: 2rem;
71
71
  font-weight: 700;
72
72
  color: var(--light);
73
73
  }
@@ -77,7 +77,9 @@
77
77
  }
78
78
 
79
79
  .logo-comp {
80
- font-size: 1rem;
80
+ margin-top: 20px;
81
+ font-size: 1.2rem;
82
+ font-weight: bold;
81
83
  color: var(--text-light);
82
84
  }
83
85
 
@@ -1,6 +1,6 @@
1
- {{#if version}}
1
+ {{#if CurrentVersion}}
2
2
  <!-- Version Info -->
3
3
  <div class="version-info">
4
- v{{version}}
4
+ v{{CurrentVersion}}
5
5
  </div>
6
6
  {{/if}}