mbkauthe 1.1.16 → 1.1.18

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/lib/main.js CHANGED
@@ -14,8 +14,6 @@ import speakeasy from "speakeasy";
14
14
  import { createRequire } from "module";
15
15
  import fs from "fs";
16
16
  import path from "path";
17
- import { marked } from "marked";
18
- import * as cheerio from 'cheerio';
19
17
 
20
18
  import dotenv from "dotenv";
21
19
  dotenv.config();
@@ -316,28 +314,14 @@ router.post("/mbkauthe/api/logout", async (req, res) => {
316
314
  }
317
315
  });
318
316
 
319
-
320
-
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
-
330
-
331
-
332
-
333
-
334
-
335
317
  router.get("/mbkauthe/login", LoginLimit, (req, res) => {
336
318
  return res.render("loginmbkauthe.handlebars", {
337
319
  layout: false,
338
320
  customURL: mbkautheVar.loginRedirectURL || '/home',
339
321
  userLoggedIn: !!req.session?.user,
340
- username: req.session?.user?.username || ''
322
+ username: req.session?.user?.username || '',
323
+ version: packageJson.version,
324
+ appName: mbkautheVar.APP_NAME.toUpperCase(),
341
325
  });
342
326
  });
343
327
 
@@ -434,6 +418,8 @@ router.get(["/mbkauthe/info", "/mbkauthe/i"], LoginLimit, async (_, res) => {
434
418
  <html>
435
419
  <head>
436
420
  <title>Version and Configuration Information</title>
421
+ <link rel="icon" type="image/x-icon" href="https://mbktechstudio.com/Assets/Images/Icon/dgicon.svg">
422
+
437
423
  <style>
438
424
  :root {
439
425
  --bg-color: #121212;
@@ -717,6 +703,10 @@ router.get(["/mbkauthe/info", "/mbkauthe/i"], LoginLimit, async (_, res) => {
717
703
  <div class="info-label">DOMAIN:</div>
718
704
  <div class="info-value">${mbkautheVar.DOMAIN}</div>
719
705
  </div>
706
+ <div class="info-row">
707
+ <div class="info-label">Login Redirect URL:</div>
708
+ <div class="info-value">${mbkautheVar.loginRedirectURL}</div>
709
+ </div>
720
710
  </div>
721
711
 
722
712
  <div class="info-section">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mbkauthe",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "MBKTechStudio's reusable authentication system for Node.js applications.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,6 +1,5 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
- {{> script/showmessage }}
4
3
 
5
4
  <head>
6
5
  <meta charset="UTF-8">
@@ -260,7 +259,7 @@
260
259
  }
261
260
 
262
261
  .terms-info {
263
- margin-top: 2rem;
262
+ margin-top: 1rem;
264
263
  font-size: 0.8rem;
265
264
  color: var(--gray);
266
265
  text-align: center;
@@ -350,6 +349,13 @@
350
349
  .login-title {
351
350
  font-size: 1.8rem;
352
351
  }
352
+
353
+ .version-info {
354
+ bottom: 10px;
355
+ right: 10px;
356
+ font-size: 0.7rem;
357
+ padding: 6px 10px;
358
+ }
353
359
  }
354
360
 
355
361
  @media (max-width: 576px) {
@@ -427,6 +433,29 @@
427
433
  text-align: center;
428
434
  box-shadow: var(--shadow-sm);
429
435
  }
436
+
437
+ .logo-comp {
438
+ font-size: 1rem;
439
+ }
440
+
441
+ .version-info {
442
+ position: fixed;
443
+ bottom: 20px;
444
+ right: 20px;
445
+ background: var(--dark-light);
446
+ color: var(--gray);
447
+ padding: 8px 12px;
448
+ border-radius: var(--radius-sm);
449
+ font-size: 0.75rem;
450
+ border: 1px solid var(--glass-border);
451
+ z-index: 999;
452
+ transition: var(--transition);
453
+ }
454
+
455
+ .version-info:hover {
456
+ color: var(--primary);
457
+ border-color: var(--primary);
458
+ }
430
459
  </style>
431
460
  </head>
432
461
 
@@ -436,12 +465,185 @@
436
465
  <div class="navbar">
437
466
  <a class="logo">
438
467
  <img src="https://mbktechstudio.com/Assets/Images/Icon/dgicon.svg" alt="MBK Tech Studio Logo">
439
- <span class="logo-text">MBK Authe</span>
468
+ <span class="logo-text">{{appName}} <span class="logo-comp">MBKTECHStudio</span></span>
440
469
  </a>
441
470
  </div>
442
471
  </nav>
443
472
  </header>
444
473
 
474
+ <div>
475
+ <div class="showMessageblurWindow">
476
+ <div class="showmessageWindow">
477
+ <h1></h1>
478
+ <p></p>
479
+ <a href="" target="_blank" class="error-code"></a>
480
+ <button class="btn btn-save full" style="font-size: 20px; margin-top: 10px;"
481
+ onclick="hideMessage()">Okay</button>
482
+ </div>
483
+ </div>
484
+ <script>
485
+ // showMessage("Failed to load the page. Please try again later.", "Error", "404");
486
+ function showMessage(message, heading, errorCode) {
487
+ document.querySelector(".showmessageWindow h1").innerText = heading;
488
+ document.querySelector(".showmessageWindow p").innerHTML = message;
489
+ if (errorCode) {
490
+ document.querySelector(".showmessageWindow .error-code").style.display = "block";
491
+ document.querySelector(".showmessageWindow .error-code").innerText = `Error Code: ${errorCode}`;
492
+ } else {
493
+ document.querySelector(".showmessageWindow .error-code").style.display = "none";
494
+ }
495
+ document.querySelector(".showmessageWindow .error-code").href = `https://mbktechstudio.com/ErrorCode/#${errorCode}`;
496
+ document
497
+ .querySelector(".showMessageblurWindow")
498
+ .classList
499
+ .add("active");
500
+ document
501
+ .body
502
+ .classList
503
+ .add("blur-active");
504
+ }
505
+ function hideMessage() {
506
+ const blurWindow = document.querySelector(".showMessageblurWindow");
507
+ blurWindow.classList.add("fade-out");
508
+ setTimeout(() => {
509
+ blurWindow.classList.remove("active", "fade-out");
510
+ document
511
+ .body
512
+ .classList
513
+ .remove("blur-active");
514
+ }, 500);
515
+ }
516
+ </script>
517
+ <style>
518
+ .showMessageblurWindow {
519
+ position: fixed;
520
+ top: 0;
521
+ left: 0;
522
+ width: 100%;
523
+ height: 100%;
524
+ background: rgba(0, 0, 0, 0.5);
525
+ display: none;
526
+ justify-content: center;
527
+ align-items: center;
528
+ z-index: 1000;
529
+ backdrop-filter: blur(10px);
530
+ }
531
+
532
+ .showMessageblurWindow.active {
533
+ display: flex;
534
+ }
535
+
536
+ .showMessageblurWindow.fade-out {
537
+ animation: fadeOut 0.5s ease-in-out forwards;
538
+ }
539
+
540
+ body.blur-active {
541
+ overflow: hidden;
542
+ }
543
+
544
+ .showmessageWindow {
545
+ display: flex;
546
+ flex-direction: column;
547
+ align-items: center;
548
+ justify-content: center;
549
+ font-family: 'Roboto', sans-serif;
550
+ background: rgba(0, 0, 0, 0.6);
551
+ padding: 20px 30px;
552
+ border-radius: 15px;
553
+ max-width: 90%;
554
+ width: 600px;
555
+ position: relative;
556
+ color: #fff;
557
+ border: 2px solid #007bff;
558
+ animation: fadeIn 0.5s ease-in-out;
559
+ }
560
+
561
+ .showmessageWindow h1 {
562
+ font-family: 'Roboto', sans-serif;
563
+ margin-top: 0;
564
+ font-size: 30px;
565
+ text-align: center;
566
+ color: #fff;
567
+ text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
568
+ margin-bottom: 10px;
569
+ }
570
+
571
+ .showmessageWindow p {
572
+ font-family: 'Roboto', sans-serif;
573
+ font-size: 18px;
574
+ text-align: center;
575
+ color: #ddd;
576
+ }
577
+
578
+ .showmessageWindow .close-btn {
579
+ position: absolute;
580
+ top: 10px;
581
+ right: 10px;
582
+ background: none;
583
+ border: none;
584
+ font-size: 30px;
585
+ cursor: pointer;
586
+ color: #bbb;
587
+ transition: color 0.3s;
588
+ }
589
+
590
+ .showmessageWindow .close-btn:hover {
591
+ color: #fff;
592
+ }
593
+
594
+ @keyframes fadeIn {
595
+ from {
596
+ opacity: 0;
597
+ transform: scale(0.9);
598
+ }
599
+
600
+ to {
601
+ opacity: 1;
602
+ transform: scale(1);
603
+ }
604
+ }
605
+
606
+ .showmessageWindow .error-code {
607
+ font-family: 'Roboto', sans-serif;
608
+ font-size: 16px;
609
+ text-align: center;
610
+ color: #ff4d4d;
611
+ font-weight: 700;
612
+ margin: 10px auto;
613
+ padding: 5px 10px;
614
+ background: rgba(255, 77, 77, 0.1);
615
+ border: 1px solid #ff4d4d;
616
+ border-radius: 5px;
617
+ display: inline-block;
618
+ transition: all 0.3s ease-in;
619
+ }
620
+
621
+ .showmessageWindow .error-code:hover {
622
+ background: rgba(255, 77, 77, 0.2);
623
+ color: #007bff;
624
+ text-decoration: none;
625
+ transition: all 0.3s ease-out;
626
+ }
627
+
628
+
629
+ .showmessageWindow .btn-save {
630
+ width: 100%;
631
+ }
632
+
633
+ @keyframes fadeOut {
634
+ from {
635
+ opacity: 1;
636
+ transform: scale(1);
637
+ }
638
+
639
+ to {
640
+ opacity: 0;
641
+ transform: scale(0.9);
642
+ }
643
+ }
644
+ </style>
645
+ </div>
646
+
445
647
  <section class="login-container">
446
648
 
447
649
  <i class="fas fa-robot ai-element"></i>
@@ -496,20 +698,27 @@
496
698
  {{/if }}
497
699
 
498
700
  <div class="login-links">
499
- <a onclick="fpass()" class="login-link">Forgot Password?</a>
701
+ <a href="https://portal.mbktechstudio.com/forgot-password" class="login-link">Forgot Password?</a>
500
702
  <a href="https://www.mbktechstudio.com/Support" target="_blank" class="login-link">Need Help?</a>
501
703
  </div>
502
704
 
503
705
  <p class="terms-info">
504
706
  By logging in, you agree to our
505
- <a href="/info/Terms&Conditions" target="_blank" class="terms-link">Terms & Conditions</a>
707
+ <a href="https://portal.mbktechstudio.com/info/Terms&Conditions" target="_blank"
708
+ class="terms-link">Terms & Conditions</a>
506
709
  and
507
- <a href="/info/PrivacyPolicy" target="_blank" class="terms-link">Privacy Policy</a>.
710
+ <a href="https://portal.mbktechstudio.com/info/PrivacyPolicy" target="_blank"
711
+ class="terms-link">Privacy Policy</a>.
508
712
  </p>
509
713
  </form>
510
714
  </div>
511
715
  </section>
512
716
 
717
+ <!-- Version Info -->
718
+ <div class="version-info">
719
+ v{{version}}
720
+ </div>
721
+
513
722
  <script>
514
723
 
515
724
  // Toggle password visibility
@@ -574,9 +783,9 @@
574
783
  sessionStorage.setItem('sessionId', data.sessionId);
575
784
 
576
785
  if (rememberMe) {
577
- localStorage.setItem('rememberedUsername', username);
786
+ setCookie('rememberedUsername', username, 30); // 30 days
578
787
  } else {
579
- localStorage.removeItem('rememberedUsername');
788
+ deleteCookie('rememberedUsername');
580
789
  }
581
790
 
582
791
  // Redirect to the appropriate page
@@ -609,6 +818,39 @@
609
818
  });
610
819
  });
611
820
 
821
+ // Cookie helper functions for cross-domain functionality
822
+ function setCookie(name, value, days) {
823
+ let expires = "";
824
+ if (days) {
825
+ const date = new Date();
826
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
827
+ expires = "; expires=" + date.toUTCString();
828
+ }
829
+ // Set cookie for the entire domain (works across all subdomains)
830
+ const domain = window.location.hostname.includes('.') ?
831
+ '.' + window.location.hostname.split('.').slice(-2).join('.') :
832
+ window.location.hostname;
833
+ document.cookie = name + "=" + (value || "") + expires + "; path=/; domain=" + domain + "; SameSite=Lax";
834
+ }
835
+
836
+ function getCookie(name) {
837
+ const nameEQ = name + "=";
838
+ const ca = document.cookie.split(';');
839
+ for (let i = 0; i < ca.length; i++) {
840
+ let c = ca[i];
841
+ while (c.charAt(0) === ' ') c = c.substring(1, c.length);
842
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
843
+ }
844
+ return null;
845
+ }
846
+
847
+ function deleteCookie(name) {
848
+ const domain = window.location.hostname.includes('.') ?
849
+ '.' + window.location.hostname.split('.').slice(-2).join('.') :
850
+ window.location.hostname;
851
+ document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=" + domain;
852
+ }
853
+
612
854
  // Check for URL parameters
613
855
  document.addEventListener('DOMContentLoaded', function () {
614
856
  const urlParams = new URLSearchParams(window.location.search);
@@ -641,6 +883,7 @@
641
883
  // Automatically focus the username field
642
884
  usernameInput.focus();
643
885
  });
886
+
644
887
  //Remember me functionality
645
888
  document.addEventListener('DOMContentLoaded', function () {
646
889
  const urlParams = new URLSearchParams(window.location.search);
@@ -648,8 +891,8 @@
648
891
  const passwordFromUrl = urlParams.get('password');
649
892
  const usernameInput = document.getElementById('loginUsername');
650
893
 
651
- // Check for remembered username in localStorage
652
- const rememberedUsername = localStorage.getItem('rememberedUsername');
894
+ // Check for remembered username in cookies
895
+ const rememberedUsername = getCookie('rememberedUsername');
653
896
  if (rememberedUsername) {
654
897
  usernameInput.value = rememberedUsername;
655
898
  document.getElementById('rememberMe').checked = true;