From 3f3653b180bbf712fa68e14d6b4852e10ddff7d1 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Thu, 16 Sep 2021 10:48:49 -0400 Subject: [PATCH] oops! --- account/src/middleware/setup-passport.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/account/src/middleware/setup-passport.ts b/account/src/middleware/setup-passport.ts index 3323468..3ac4931 100644 --- a/account/src/middleware/setup-passport.ts +++ b/account/src/middleware/setup-passport.ts @@ -66,8 +66,11 @@ function setupPassport(passport: PassportStatic) { const googleMail = profile.emails && profile.emails[0].value; if (googleMail) { const otherAccountWSameEmail = await getLingdocsUser("email", googleMail); - otherAccountWSameEmail && await updateLingdocsUser(otherAccountWSameEmail?.userId, { google: gProfile }); - return done(null, otherAccountWSameEmail); + console.log("found user with same gmail email"); + if (otherAccountWSameEmail) { + await updateLingdocsUser(otherAccountWSameEmail.userId, { google: gProfile }); + return done(null, otherAccountWSameEmail); + } } const u = await updateLingdocsUser(req.user.userId, { google: gProfile }); if (!u.email) {