0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

chore(core): remove unused checkMissingRequiredSignUpIdentifiers (#2571)

This commit is contained in:
Xiao Yijun 2022-12-02 12:20:21 +08:00 committed by GitHub
parent bb53b32c1d
commit b8f0b0cca2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -194,33 +194,6 @@ export const checkRequiredProfile = async (
throw new RequestError({ code: 'user.require_sms', status: 422 });
}
};
export const checkMissingRequiredSignUpIdentifiers = async (identifiers: {
primaryEmail?: Nullable<string>;
primaryPhone?: Nullable<string>;
}) => {
// We do not check username as we decided to prohibit the removal of username from user profile.
const { primaryEmail, primaryPhone } = identifiers;
const { signUp } = await getSignInExperienceForApplication();
if (
signUp.identifiers.includes(SignInIdentifier.Email) &&
signUp.identifiers.includes(SignInIdentifier.Sms) &&
!primaryEmail &&
!primaryPhone
) {
throw new RequestError({ code: 'user.require_email_or_sms', status: 422 });
}
if (signUp.identifiers.includes(SignInIdentifier.Email) && !primaryEmail) {
throw new RequestError({ code: 'user.require_email', status: 422 });
}
if (signUp.identifiers.includes(SignInIdentifier.Sms) && !primaryPhone) {
throw new RequestError({ code: 'user.require_sms', status: 422 });
}
};
/* eslint-enable complexity */
export const checkSignUpIdentifierCollision = async (