Преглед изворни кода

resolved header already sent error

sou пре 7 година
родитељ
комит
78b8fb4dbb
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      lib/routes/login-passport.js

+ 5 - 2
lib/routes/login-passport.js

@@ -104,6 +104,10 @@ module.exports = function(crowi, app) {
     }
     }
 
 
     const externalAccount = await getOrCreateUser(req, res, next, userInfo, providerId);
     const externalAccount = await getOrCreateUser(req, res, next, userInfo, providerId);
+    if (!externalAccount) {
+      return loginFailure(req, res, next);
+    }
+
     const user = await externalAccount.getPopulatedUser();
     const user = await externalAccount.getPopulatedUser();
 
 
     // login
     // login
@@ -314,10 +318,9 @@ module.exports = function(crowi, app) {
         }
         }
         else {
         else {
           req.flash('provider-DuplicatedUsernameException', providerId);
           req.flash('provider-DuplicatedUsernameException', providerId);
-          return loginFailure(req, res, next);
+          return;
         }
         }
       }
       }
-      // throw err;  // throw again
     }
     }
   }
   }