Skip to content

Commit 72e5575

Browse files
Fixed password users not able to login via google.
1 parent a859192 commit 72e5575

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/service/passport/strategies/google.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ class GoogleStrategy {
5757
if (!profile.name.familyName) {
5858
return cb(new Error("Google profile does not contain a family name."), undefined);
5959
}
60-
const existingUser = await UserModel.findOne({ googleProfileId: profile.id }).lean();
6160
let email = profile.emails[0].value;
61+
const existingUser = await UserModel.findOne({
62+
$or: [{ googleProfileId: profile.id }, { email: email }],
63+
}).lean();
6264
if (existingUser) {
6365
log.info("User found from Google profile.");
6466
UserModel.updateOne(

0 commit comments

Comments
 (0)