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:
parent
51e39eeb3b
commit
d8deb0285f
2 changed files with 19 additions and 1 deletions
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue