瀏覽代碼

Correction bug verification de l'authentification

Loquicom 5 年之前
父節點
當前提交
b09ce44cbf
共有 1 個文件被更改,包括 12 次插入1 次删除
  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) {