mbkauthe 1.0.10 → 1.0.11

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
@@ -128,7 +128,8 @@ router.post("/mbkauthe/api/login", async (req, res) => {
128
128
  const secretKey = mbkautheVar.RECAPTCHA_SECRET_KEY;
129
129
  const verificationUrl = `https://www.google.com/recaptcha/api/siteverify?secret=${secretKey}&response=${recaptcha}`;
130
130
 
131
- let BypassUsers = [mbkautheVar.BypassUsers];
131
+ let BypassUsers = Array.isArray(mbkautheVar.BypassUsers) ? mbkautheVar.BypassUsers : JSON.parse(mbkautheVar.BypassUsers); // Ensure it's a flat array
132
+
132
133
  if (mbkautheVar.RECAPTCHA_Enabled === "true") {
133
134
  if (!BypassUsers.includes(username)) {
134
135
  if (!recaptcha) {
@@ -60,6 +60,9 @@ async function validateSession(req, res, next) {
60
60
  if (userResult.Role !== "SuperAdmin") {
61
61
  const allowedApps = userResult.AllowedApps;
62
62
  if (!allowedApps || !allowedApps.includes(mbkautheVar.APP_NAME)) {
63
+ console.log(`Allowed Apps for user "${req.session.user.username}": ${allowedApps}`);
64
+ console.log(!allowedApps);
65
+ console.log(!allowedApps.includes(mbkautheVar.APP_NAME));
63
66
  console.warn(`User \"${req.session.user.username}\" is not authorized to use the application \"${mbkautheVar.APP_NAME}\"`);
64
67
  req.session.destroy();
65
68
  res.clearCookie("mbkauthe.sid", { domain: `.${mbkautheVar.DOMAIN}` });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mbkauthe",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "MBKTechStudio's reusable authentication system for Node.js applications.",
5
5
  "main": "index.js",
6
6
  "type": "module",