Skip to content

Commit

Permalink
feat: limit user names allowed (#3908)
Browse files Browse the repository at this point in the history
  • Loading branch information
YazeedLoonat authored Feb 28, 2024
1 parent 8fea8b4 commit c5bc517
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/src/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,15 @@ export class UserService {
requestingUser: User,
jurisdictionName?: string,
): Promise<User> {
if (
this.containsInvalidCharacters(dto.firstName) ||
this.containsInvalidCharacters(dto.lastName)
) {
throw new ForbiddenException(
`${dto.firstName} ${dto.lastName} was found to be invalid`,
);
}

if (forPartners) {
await this.authorizeAction(
requestingUser,
Expand Down Expand Up @@ -849,4 +858,8 @@ export class UserService {
return misMatched;
}, []);
}

containsInvalidCharacters(value: string): boolean {
return value.includes('.') || value.includes('http');
}
}

0 comments on commit c5bc517

Please sign in to comment.