Skip to content

Commit ddecae4

Browse files
committed
update existing google user details like email when they already exist in the db but their email doesn't
1 parent 9fc1dd8 commit ddecae4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

apps/webapp/app/models/user.server.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,19 @@ export async function findOrCreateGoogleUser({
247247
};
248248
}
249249

250+
// When the IDP user (Google) already exists, the "update" path will be taken and the email will be updated
251+
// It's not possible that the email is already taken by a different user because that would have been handled
252+
// by one of the if statements above.
250253
const user = await prisma.user.upsert({
251254
where: {
252255
authIdentifier,
253256
},
254-
update: {},
257+
update: {
258+
email,
259+
displayName,
260+
name,
261+
avatarUrl,
262+
},
255263
create: {
256264
authenticationProfile: authProfile,
257265
authenticationExtraParams: authExtraParams,

0 commit comments

Comments
 (0)