isundil 1 year ago
parent
commit
8fc935e46f
3 changed files with 24 additions and 3 deletions
  1. 18 2
      package-lock.json
  2. 2 1
      package.json
  3. 4 0
      src/routerUtils.js

+ 18 - 2
package-lock.json

@@ -1,16 +1,17 @@
 {
   "name": "craftlabhttpserver",
-  "version": "20240122.4",
+  "version": "20240122.5",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "craftlabhttpserver",
-      "version": "20240122.4",
+      "version": "20240122.5",
       "license": "GPL-3.0",
       "dependencies": {
         "@mdi/font": "^7.4.47",
         "bootstrap": "^5.3.2",
+        "bootstrap-icons": "^1.11.3",
         "ldapjs": "^3.0.7",
         "mime-types": "^2.1.35",
         "node-simple-router": "^0.10.2",
@@ -305,6 +306,21 @@
         "@popperjs/core": "^2.11.8"
       }
     },
+    "node_modules/bootstrap-icons": {
+      "version": "1.11.3",
+      "resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.11.3.tgz",
+      "integrity": "sha512-+3lpHrCw/it2/7lBL15VR0HEumaBss0+f/Lb6ZvHISn1mlK83jjFpooTLsMWbIjJMDjDjOExMsTxnXSIT4k4ww==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/twbs"
+        },
+        {
+          "type": "opencollective",
+          "url": "https://opencollective.com/bootstrap"
+        }
+      ]
+    },
     "node_modules/brace-expansion": {
       "version": "1.1.11",
       "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",

+ 2 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "craftlabhttpserver",
-  "version": "20240122.5",
+  "version": "20240122.6",
   "description": "",
   "main": "main.js",
   "scripts": {
@@ -15,6 +15,7 @@
   "dependencies": {
     "@mdi/font": "^7.4.47",
     "bootstrap": "^5.3.2",
+    "bootstrap-icons": "^1.11.3",
     "ldapjs": "^3.0.7",
     "mime-types": "^2.1.35",
     "node-simple-router": "^0.10.2",

+ 4 - 0
src/routerUtils.js

@@ -36,6 +36,10 @@ RouterUtils.prototype.onApiRequest = function(req, res) {
     }
 };
 
+RouterUtils.prototype.onUnauthorized =function(res) {
+    return this.httpResponse(res, 403, "Unauthorized Access");
+};
+
 RouterUtils.prototype.apiRequireLogin =function(req, res, validTokens) {
     if (Security.isLoggedUser(req.cookies))
     {