This commit is contained in:
lingdocs 2021-09-16 10:48:49 -04:00
parent f9b239657c
commit 3f3653b180
1 changed files with 5 additions and 2 deletions

View File

@ -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) {