From 19aba4b6c092c2ba9aea550c20e0adeaac156fba Mon Sep 17 00:00:00 2001 From: Robotboyx Date: Fri, 13 Dec 2019 06:13:37 +0700 Subject: [PATCH] Login bug solved --- lib/oauth2.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/oauth2.js b/lib/oauth2.js index c0069ed..44cdd71 100644 --- a/lib/oauth2.js +++ b/lib/oauth2.js @@ -103,17 +103,20 @@ router.get( var userImgUrl = result.rows[0].img_url; req.session.passport.user.role = userRole; req.session.passport.user.apartment = userApartment; - - if (userImgUrl == null || userImgUrl != req.user.image) { - pool.query("UPDATE account SET img_url = $1 WHERE email = $2;", [req.user.image, req.user.email], function (err, result1) { - if (err) { res.send(err)} - else { - next(); - } - }) - } else { - next() - } + + // console.log("userImgUrl",userImgUrl); + // console.log("userImgUrl",req.user) + // if (userImgUrl == null || userImgUrl != req.user.image || userImgUrl == undefined) { + // pool.query("UPDATE account SET img_url = $1 WHERE email = $2;", [req.user.image, req.user.email], function (err, result1) { + // if (err) { res.send(err)} + // else { + // next(); + // } + // }) + // } else { + // next() + // } + next() } else { res.send("Sorry " + req.user.displayName + "! We couldn't find your account in our database! Please contact our adminstrator to add you in!")