mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -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();
|
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 () => {
|
it('email missing but required', async () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
...baseCtx,
|
...baseCtx,
|
||||||
|
|
|
@ -23,7 +23,13 @@ const getMissingProfileBySignUpIdentifiers = ({
|
||||||
}) => {
|
}) => {
|
||||||
const missingProfile = new Set<MissingProfile>();
|
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);
|
missingProfile.add(MissingProfile.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue