fix: email not being checked case insensitive on team invitation acceptance (#3174)
This commit is contained in:
@@ -256,7 +256,9 @@ export class TeamInvitationService {
|
|||||||
pipe(
|
pipe(
|
||||||
undefined,
|
undefined,
|
||||||
TE.fromPredicate(
|
TE.fromPredicate(
|
||||||
(a) => acceptedBy.email === invitation.inviteeEmail,
|
() =>
|
||||||
|
acceptedBy.email.toLowerCase() ===
|
||||||
|
invitation.inviteeEmail.toLowerCase(),
|
||||||
() => TEAM_INVITE_EMAIL_DO_NOT_MATCH,
|
() => TEAM_INVITE_EMAIL_DO_NOT_MATCH,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import * as O from 'fp-ts/Option';
|
|||||||
import * as T from 'fp-ts/Task';
|
import * as T from 'fp-ts/Task';
|
||||||
import * as TE from 'fp-ts/TaskEither';
|
import * as TE from 'fp-ts/TaskEither';
|
||||||
import { GqlExecutionContext } from '@nestjs/graphql';
|
import { GqlExecutionContext } from '@nestjs/graphql';
|
||||||
import { User } from 'src/user/user.model';
|
|
||||||
import {
|
import {
|
||||||
BUG_AUTH_NO_USER_CTX,
|
BUG_AUTH_NO_USER_CTX,
|
||||||
BUG_TEAM_INVITE_NO_INVITE_ID,
|
BUG_TEAM_INVITE_NO_INVITE_ID,
|
||||||
@@ -55,7 +54,8 @@ export class TeamInviteeGuard implements CanActivate {
|
|||||||
// Check if the emails match
|
// Check if the emails match
|
||||||
TE.chainW(
|
TE.chainW(
|
||||||
TE.fromPredicate(
|
TE.fromPredicate(
|
||||||
({ user, invite }) => user.email === invite.inviteeEmail,
|
({ user, invite }) =>
|
||||||
|
user.email.toLowerCase() === invite.inviteeEmail.toLowerCase(),
|
||||||
() => TEAM_INVITE_EMAIL_DO_NOT_MATCH,
|
() => TEAM_INVITE_EMAIL_DO_NOT_MATCH,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user