mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(core): should not block social email/phone identifiers by SIE (#3201)
This commit is contained in:
parent
ad1c1eb75e
commit
86b796e989
2 changed files with 37 additions and 3 deletions
|
@ -266,6 +266,36 @@ describe('identifier validation', () => {
|
||||||
});
|
});
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('connector phone should not throw', () => {
|
||||||
|
const identifier = { phone: '123456', connectorId: 'logto' };
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
verifyIdentifierSettings(identifier, {
|
||||||
|
...mockSignInExperience,
|
||||||
|
signIn: {
|
||||||
|
methods: mockSignInExperience.signIn.methods.filter(
|
||||||
|
({ identifier }) => identifier !== SignInIdentifier.Phone
|
||||||
|
),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}).not.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('connector email should not throw', () => {
|
||||||
|
const identifier = { email: 'foo@logto.io', connectorId: 'logto' };
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
verifyIdentifierSettings(identifier, {
|
||||||
|
...mockSignInExperience,
|
||||||
|
signIn: {
|
||||||
|
methods: mockSignInExperience.signIn.methods.filter(
|
||||||
|
({ identifier }) => identifier !== SignInIdentifier.Email
|
||||||
|
),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}).not.toThrow();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('profile validation', () => {
|
describe('profile validation', () => {
|
||||||
|
|
|
@ -43,6 +43,12 @@ export const verifyIdentifierSettings = (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Social Identifier TODO: @darcy, @sijie
|
||||||
|
// should not verify connector related identifier here
|
||||||
|
if ('connectorId' in identifier) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Email Identifier
|
// Email Identifier
|
||||||
if ('email' in identifier) {
|
if ('email' in identifier) {
|
||||||
assertThat(
|
assertThat(
|
||||||
|
@ -87,7 +93,7 @@ export const verifyIdentifierSettings = (
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Phone verificationCode Verification: SignIn verificationCode enabled or SignUp Email verify enabled
|
// Phone verificationCode Verification: SignIn verificationCode enabled or SignUp Phone verify enabled
|
||||||
if (
|
if (
|
||||||
'verificationCode' in identifier &&
|
'verificationCode' in identifier &&
|
||||||
!verificationCode &&
|
!verificationCode &&
|
||||||
|
@ -102,8 +108,6 @@ export const verifyIdentifierSettings = (
|
||||||
forbiddenIdentifierError()
|
forbiddenIdentifierError()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Social Identifier TODO: @darcy, @sijie
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const verifyProfileSettings = (profile: Profile, { signUp }: SignInExperience) => {
|
export const verifyProfileSettings = (profile: Profile, { signUp }: SignInExperience) => {
|
||||||
|
|
Loading…
Reference in a new issue