🐛 Fix account linking when using SSO (#1016)

This commit is contained in:
Luke Vella 2024-02-06 11:37:56 +07:00 committed by GitHub
parent 996ca88840
commit 213152e652
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View file

@ -222,8 +222,8 @@ const getAuthOptions = (...args: GetServerSessionParams) =>
} else {
// merge guest user into newly logged in user
const session = await getServerSession(...args);
if (session && session.user.email === null) {
await mergeGuestsIntoUser(user.id, [session.user.id]);
if (session && user.email && session.user.email === null) {
await mergeGuestsIntoUser(user.email, [session.user.id]);
}
posthog?.capture({