From b4b8015db583d4c8ccbd42bbc39b47ed97e7886d Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Mon, 6 May 2024 10:21:45 +0800 Subject: [PATCH] fix(core): invitee email check should be case insensitive (#5823) * fix(core): invitee email check should be case insensitive * chore: add changeset --- .changeset/popular-chicken-share.md | 5 +++++ packages/core/src/libraries/organization-invitation.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/popular-chicken-share.md diff --git a/.changeset/popular-chicken-share.md b/.changeset/popular-chicken-share.md new file mode 100644 index 000000000..0a8968351 --- /dev/null +++ b/.changeset/popular-chicken-share.md @@ -0,0 +1,5 @@ +--- +"@logto/core": patch +--- + +fix a bug that prevents invitee from accepting the organization invitation if the email letter case is not matching diff --git a/packages/core/src/libraries/organization-invitation.ts b/packages/core/src/libraries/organization-invitation.ts index 17859be08..a89a8717f 100644 --- a/packages/core/src/libraries/organization-invitation.ts +++ b/packages/core/src/libraries/organization-invitation.ts @@ -157,7 +157,7 @@ export class OrganizationInvitationLibrary { const user = await userQueries.findUserById(acceptedUserId); - if (user.primaryEmail !== entity.invitee) { + if (user.primaryEmail?.toLowerCase() !== entity.invitee.toLowerCase()) { throw new RequestError({ status: 422, code: 'request.invalid_input',