diff --git a/srcs/requirements/nestjs/api_back/src/auth/42/authentication.service.ts b/srcs/requirements/nestjs/api_back/src/auth/42/authentication.service.ts index b338ce7b..3d4098ac 100644 --- a/srcs/requirements/nestjs/api_back/src/auth/42/authentication.service.ts +++ b/srcs/requirements/nestjs/api_back/src/auth/42/authentication.service.ts @@ -24,10 +24,12 @@ export class AuthenticationService { if (!check_name) return await this.userService.create(createUsersDto); let createUsersDtoWithUsername : CreateUsersDto = createUsersDto; + let i = 0; while (check_name === true) { - createUsersDtoWithUsername = { ...createUsersDto, username: createUsersDto.username + randomUUID() }; + createUsersDtoWithUsername = { ...createUsersDto, username: createUsersDto.username + '_' + i}; check_name = await this.userService.isUsernameExists(createUsersDtoWithUsername.username); + i++; } return this.userService.create(createUsersDtoWithUsername); } diff --git a/srcs/requirements/nestjs/api_back/src/chat/chat.service.ts b/srcs/requirements/nestjs/api_back/src/chat/chat.service.ts index a97d9004..8313583b 100644 --- a/srcs/requirements/nestjs/api_back/src/chat/chat.service.ts +++ b/srcs/requirements/nestjs/api_back/src/chat/chat.service.ts @@ -372,11 +372,14 @@ export class ChatService { async getListBlockUser(username: string): Promise { printCaller("-- in "); - + let users: string[] = []; let user = await this.getUserByName(username); - let friends_users = await this.friendshipService.findAllBlockedFriends(user.id); - let users = friends_users.map(user => user.receiverUsername); - + console.log("USERNAME CHAT SRVICE " + username); + let friends_users; + if (user) + friends_users = await this.friendshipService.findAllBlockedFriends(user.id); + if (friends_users) + users = friends_users.map(user => user.receiverUsername); printCaller("-- out "); return users; } 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 3c0e6472..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,9 +1,11 @@ -import { IsBoolean, 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/public/global.css b/srcs/requirements/svelte/api_front/public/global.css index 4a77fd07..25ba58a6 100644 --- a/srcs/requirements/svelte/api_front/public/global.css +++ b/srcs/requirements/svelte/api_front/public/global.css @@ -26,6 +26,16 @@ body { font-display: swap; } +@font-face { + font-family: "Bit5x3"; + src: + url("/fonts/Bit5x3.woff2") format("woff2"), + local("Bit5x3"), + url("/fonts/Bit5x3.woff") format("woff"); + font-weight: normal; + font-style: normal; + font-display: swap; +} a { color: rgb(0,100,200); diff --git a/srcs/requirements/svelte/api_front/src/pages/game/Game.svelte b/srcs/requirements/svelte/api_front/src/pages/game/Game.svelte index ccb4242a..855ef0c4 100644 --- a/srcs/requirements/svelte/api_front/src/pages/game/Game.svelte +++ b/srcs/requirements/svelte/api_front/src/pages/game/Game.svelte @@ -390,19 +390,20 @@ {/if} {/if} +
.
+