mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
feat: update social info on sign in (#225)
This commit is contained in:
parent
e8c2b100a3
commit
a9b5dd6cbd
1 changed files with 6 additions and 1 deletions
|
@ -12,6 +12,7 @@ import {
|
|||
hasUserWithPhone,
|
||||
hasUserWithIdentity,
|
||||
findUserByIdentity,
|
||||
updateUserById,
|
||||
} from '@/queries/user';
|
||||
import assertThat from '@/utils/assert-that';
|
||||
import { emailRegEx, phoneRegEx } from '@/utils/regex';
|
||||
|
@ -136,7 +137,11 @@ export const signInWithSocial = async (
|
|||
})
|
||||
);
|
||||
|
||||
const { id } = await findUserByIdentity(connectorId, userInfo.id);
|
||||
const { id, identities } = await findUserByIdentity(connectorId, userInfo.id);
|
||||
// Update social connector's user info
|
||||
await updateUserById(id, {
|
||||
identities: { ...identities, [connectorId]: { userId: userInfo.id, details: userInfo } },
|
||||
});
|
||||
ctx.userLog.userId = id;
|
||||
await assignSignInResult(ctx, provider, id);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue