0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(core): register with social should not ask for password (#2793)

This commit is contained in:
simeng-li 2022-12-31 09:30:07 +08:00 committed by GitHub
parent 51e39eeb3b
commit d8deb0285f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -64,6 +64,18 @@ describe('validateMandatoryUserProfile', () => {
await expect(validateMandatoryUserProfile(baseCtx, interaction)).resolves.not.toThrow();
});
it('register user has social profile', async () => {
await expect(
validateMandatoryUserProfile(baseCtx, {
event: InteractionEvent.Register,
profile: {
username: 'foo',
connectorId: 'logto',
},
})
).resolves.not.toThrow();
});
it('email missing but required', async () => {
const ctx = {
...baseCtx,

View file

@ -23,7 +23,13 @@ const getMissingProfileBySignUpIdentifiers = ({
}) => {
const missingProfile = new Set<MissingProfile>();
if (signUp.password && !(user && isUserPasswordSet(user)) && !profile?.password) {
if (
signUp.password &&
!(user && isUserPasswordSet(user)) &&
!profile?.password &&
// Social identities can take place the role of password
!profile?.connectorId
) {
missingProfile.add(MissingProfile.password);
}