0
Fork 0
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:
simeng-li 2023-02-24 16:04:43 +08:00 committed by GitHub
parent ad1c1eb75e
commit 86b796e989
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 3 deletions

View file

@ -266,6 +266,36 @@ describe('identifier validation', () => {
});
}).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', () => {

View file

@ -43,6 +43,12 @@ export const verifyIdentifierSettings = (
return;
}
// Social Identifier TODO: @darcy, @sijie
// should not verify connector related identifier here
if ('connectorId' in identifier) {
return;
}
// Email Identifier
if ('email' in identifier) {
assertThat(
@ -87,7 +93,7 @@ export const verifyIdentifierSettings = (
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 (
'verificationCode' in identifier &&
!verificationCode &&
@ -102,8 +108,6 @@ export const verifyIdentifierSettings = (
forbiddenIdentifierError()
);
}
// Social Identifier TODO: @darcy, @sijie
};
export const verifyProfileSettings = (profile: Profile, { signUp }: SignInExperience) => {