There was an error while loading. Please reload this page.
1 parent a859192 commit 72e5575Copy full SHA for 72e5575
1 file changed
src/service/passport/strategies/google.ts
@@ -57,8 +57,10 @@ class GoogleStrategy {
57
if (!profile.name.familyName) {
58
return cb(new Error("Google profile does not contain a family name."), undefined);
59
}
60
- const existingUser = await UserModel.findOne({ googleProfileId: profile.id }).lean();
61
let email = profile.emails[0].value;
+ const existingUser = await UserModel.findOne({
62
+ $or: [{ googleProfileId: profile.id }, { email: email }],
63
+ }).lean();
64
if (existingUser) {
65
log.info("User found from Google profile.");
66
UserModel.updateOne(
0 commit comments