mbkauthe 4.8.2 → 4.8.3

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.
@@ -510,14 +510,14 @@ const checkRolePermission = (requiredRoles, notAllowed) => {
510
510
  });
511
511
  }
512
512
 
513
+ // Use role from validateSession to avoid additional DB query
514
+ const userRole = req.userRole;
515
+
513
516
  // SuperAdmin bypasses all role checks
514
- if(req.session.role === "SuperAdmin") {
517
+ if(req.session.role === "SuperAdmin" || userRole === "SuperAdmin") {
515
518
  return next();
516
519
  }
517
520
 
518
- // Use role from validateSession to avoid additional DB query
519
- const userRole = req.userRole;
520
-
521
521
  // Check notAllowed role
522
522
  if (notAllowed && userRole === notAllowed) {
523
523
  if (isJsonRequest(req)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mbkauthe",
3
- "version": "4.8.2",
3
+ "version": "4.8.3",
4
4
  "description": "MBKTech's reusable authentication system for Node.js applications.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -84,6 +84,7 @@
84
84
  try {
85
85
  const response = await fetch('/mbkauthe/api/verify-2fa', {
86
86
  method: 'POST',
87
+ credentials: 'include',
87
88
  headers: {
88
89
  'Content-Type': 'application/json'
89
90
  },
@@ -287,6 +287,7 @@
287
287
  const pageRedirect = new URLSearchParams(window.location.search).get('redirect');
288
288
  fetch('/mbkauthe/api/login', {
289
289
  method: 'POST',
290
+ credentials: 'include',
290
291
  headers: {
291
292
  'Content-Type': 'application/json'
292
293
  },