diff --git a/packages/hoppscotch-backend/src/team-invitation/team-invitation.service.ts b/packages/hoppscotch-backend/src/team-invitation/team-invitation.service.ts index 98610bde1d..0253d371e5 100644 --- a/packages/hoppscotch-backend/src/team-invitation/team-invitation.service.ts +++ b/packages/hoppscotch-backend/src/team-invitation/team-invitation.service.ts @@ -256,7 +256,9 @@ export class TeamInvitationService { pipe( undefined, TE.fromPredicate( - (a) => acceptedBy.email === invitation.inviteeEmail, + () => + acceptedBy.email.toLowerCase() === + invitation.inviteeEmail.toLowerCase(), () => TEAM_INVITE_EMAIL_DO_NOT_MATCH, ), ), diff --git a/packages/hoppscotch-backend/src/team-invitation/team-invitee.guard.ts b/packages/hoppscotch-backend/src/team-invitation/team-invitee.guard.ts index 1f2bdaa5df..b87615afa6 100644 --- a/packages/hoppscotch-backend/src/team-invitation/team-invitee.guard.ts +++ b/packages/hoppscotch-backend/src/team-invitation/team-invitee.guard.ts @@ -5,7 +5,6 @@ import * as O from 'fp-ts/Option'; import * as T from 'fp-ts/Task'; import * as TE from 'fp-ts/TaskEither'; import { GqlExecutionContext } from '@nestjs/graphql'; -import { User } from 'src/user/user.model'; import { BUG_AUTH_NO_USER_CTX, BUG_TEAM_INVITE_NO_INVITE_ID, @@ -55,7 +54,8 @@ export class TeamInviteeGuard implements CanActivate { // Check if the emails match TE.chainW( TE.fromPredicate( - ({ user, invite }) => user.email === invite.inviteeEmail, + ({ user, invite }) => + user.email.toLowerCase() === invite.inviteeEmail.toLowerCase(), () => TEAM_INVITE_EMAIL_DO_NOT_MATCH, ), ),