diff --git a/srcs/requirements/nestjs/api_back/src/users/dto/create-users.dto.ts b/srcs/requirements/nestjs/api_back/src/users/dto/create-users.dto.ts index 8b1a2529..9b61c95a 100644 --- a/srcs/requirements/nestjs/api_back/src/users/dto/create-users.dto.ts +++ b/srcs/requirements/nestjs/api_back/src/users/dto/create-users.dto.ts @@ -1,10 +1,11 @@ -import { IsBoolean, Matches, IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator'; +import { IsBoolean, Matches, MaxLength, IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator'; import { isSet } from 'util/types'; export class CreateUsersDto { @IsString() @IsNotEmpty() @Matches(/^[a-zA-Z0-9'-_]+$/) + @MaxLength(50) readonly username: string; readonly fortyTwoId: string; @IsEmail() diff --git a/srcs/requirements/svelte/api_front/src/pages/profile/ProfileSettings.svelte b/srcs/requirements/svelte/api_front/src/pages/profile/ProfileSettings.svelte index f4fa2699..a5058dee 100644 --- a/srcs/requirements/svelte/api_front/src/pages/profile/ProfileSettings.svelte +++ b/srcs/requirements/svelte/api_front/src/pages/profile/ProfileSettings.svelte @@ -51,7 +51,7 @@ .then((response) => { if (!response.ok) { success.username = '' - errors.username = "Use [a-zA-Z0-9] and - _ ."; + errors.username = "Max length : 50 . Use [a-zA-Z0-9] and - _ ."; if (response.status === 409) { errors.username = `${set.username} is already in use, pick a different one.`; }