Sfoglia il codice sorgente

Bug fix: Moved an await outside of it's async function and didn't update the functions.

Lee Morgan 5 anni fa
parent
commit
4df8defbe5
2 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 1 1
      controllers/otherData.js
  2. 2 2
      middleware.js

+ 1 - 1
controllers/otherData.js

@@ -15,7 +15,7 @@ module.exports = {
         Merchant.findOne({email: req.body.email.toLowerCase()})
             .then((merchant)=>{
                 if(merchant !== null){
-                    bcrypt.compare(req.body.password, merchant.password, (err, result)=>{
+                    bcrypt.compare(req.body.password, merchant.password, async (err, result)=>{
                         if(result === true){
                             //Check if email has not been verified
                             if(merchant.status.includes("unverified")){

+ 2 - 2
middleware.js

@@ -12,7 +12,7 @@ module.exports = {
         }
     
         Merchant.findOne({"session.sessionId": req.session.user})
-            .then(async (merchant)=>{
+            .then((merchant)=>{
                 if(merchant === null){
                     throw "login";
                 }
@@ -27,7 +27,7 @@ module.exports = {
                     merchant.save();
                     throw "login";
                 }
-                
+
                 res.locals.merchant = merchant;
                 return next();
             })