Skip to content

Commit

Permalink
fix: email not being checked case insensitive on team invitation acce…
Browse files Browse the repository at this point in the history
…ptance (hoppscotch#3174)
  • Loading branch information
AndrewBastin authored Jul 11, 2023
1 parent b2af353 commit b29c04c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
),
),
Expand Down

0 comments on commit b29c04c

Please sign in to comment.