Parcourir la source

Correction bug verification de l'authentification

Loquicom il y a 5 ans
Parent
commit
b09ce44cbf
1 fichiers modifiés avec 12 ajouts et 1 suppressions
  1. 12 1
      node/src/router.js

+ 12 - 1
node/src/router.js

@@ -72,7 +72,18 @@ const router = class Router {
             res.json(error(ERR_TOKEN));
             return;
         }
-        next();
+        let promise = db.userExist(req.body.user);
+        if (promise === false) {
+            res.json(error(ERR_REQUEST));
+            return;
+        }
+        promise.then((exist) => {
+            if (exist) {
+                next();
+            } else {
+                res.json(error(ERR_UNKNOW));
+            }
+        });
     }
 
     verbose(req, res, next) {