Kaynağa Gözat

Bug fix: Hid all pages on accident.

Lee Morgan 1 yıl önce
ebeveyn
işleme
75ceb112c5
2 değiştirilmiş dosya ile 9 ekleme ve 3 silme
  1. 8 2
      auth.js
  2. 1 1
      views/index.html

+ 8 - 2
auth.js

@@ -16,13 +16,19 @@ const userAuth = async (req, res, next)=>{
         next();
     }catch(e){
         if(e.message === "Cannot read properties of undefined (reading 'split')"){
-            const error = new CustomError(400, "Must provide authorization token");
+            const error = new HttpError(400, "Must provide authorization token");
             catchError(error, req, res, next);
             return;
         }
 
         if(e.message === "jwt malformed"){
-            const error = new CustomError(400, "Invalid JWT");
+            const error = new HttpError(400, "Invalid JWT");
+            catchError(error, req, res, next);
+            return;
+        }
+
+        if(e.message === "jwt must be provided"){
+            const error = new HttpError(400, "No auth");
             catchError(error, req, res, next);
             return;
         }

+ 1 - 1
views/index.html

@@ -67,7 +67,7 @@
         <button id="registerToLogin" class="link">Log In</button>
     </div>
 
-    <div id="loginPage" class="page" style="display:none">
+    <div id="loginPage" class="page">
         <form id="loginForm" class="standardForm">
             <h1>Log In</h1>