From 0496b345771c5976c2cbfdaff9173aba83af283f Mon Sep 17 00:00:00 2001 From: simplonco Date: Sat, 14 Jan 2023 23:05:01 +0100 Subject: [PATCH 1/7] wip add and change password + changed on_click --- .../api_back/src/chat/chat.controller.ts | 7 ++++ .../src/pieces/chat/Element_button.svelte | 4 +-- .../src/pieces/chat/Layout_home.svelte | 2 +- .../src/pieces/chat/Layout_invite.svelte | 2 +- .../src/pieces/chat/Layout_new.svelte | 2 +- .../src/pieces/chat/Layout_room.svelte | 2 +- .../src/pieces/chat/Layout_room_set.svelte | 36 +++++++++++++++++-- 7 files changed, 45 insertions(+), 10 deletions(-) diff --git a/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts b/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts index 5911f152..33dcf948 100644 --- a/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts +++ b/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts @@ -302,6 +302,13 @@ export class ChatController { const room_name = await this.chatService.getCurrentRoomName(req.user.username); const room = await this.chatService.getRoomByName(room_name); const users = room.users; + + let index = users.indexOf(req.user.username); + if (index > -1) + { + users.splice(index, 1); + } + res.status(HttpStatus.OK).json({ users: users }); printCaller("- out "); } diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Element_button.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Element_button.svelte index 4f82c334..bd5148b4 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Element_button.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Element_button.svelte @@ -2,7 +2,6 @@ diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_home.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_home.svelte index 096d2733..044a7437 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_home.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_home.svelte @@ -55,7 +55,7 @@

rooms are loading...

{:then rooms} {#each rooms as room} - {/each} diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_invite.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_invite.svelte index 36aa78a5..10b86d4b 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_invite.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_invite.svelte @@ -52,7 +52,7 @@

users are loading...

{:then users} {#each users as user} - {/each} diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_new.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_new.svelte index 77c5af26..a6940d57 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_new.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_new.svelte @@ -56,7 +56,7 @@

rooms are loading...

{:then rooms} {#each rooms as room} - {/each} diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_room.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_room.svelte index 03a0e918..49de63a7 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_room.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_room.svelte @@ -71,7 +71,7 @@ - diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_room_set.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_room_set.svelte index cdd986af..018c3ecc 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_room_set.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_room_set.svelte @@ -8,9 +8,26 @@ let users = get_room_users(); + console.log("current_room:", $current_room); + + function change_password() + { + console.log("in change_password"); + } + + function remove_password() + { + console.log("in remove_password"); + } + + function add_password() + { + console.log("in add_password"); + } + function user_profile() { - console/log("in user_profile"); + console.log("in user_profile"); } function user_leave_room() @@ -42,13 +59,26 @@
{#if $current_room.type !== "direct"} - {/if} + {#if $current_room.protection } +

this room is password protected

+ + + {:else} + + {/if}

room users :

@@ -58,7 +88,7 @@

list of users is loading...

{:then users} {#each users as user} - {/each} From f3d0af47389d615f57919408ebad626f59706224 Mon Sep 17 00:00:00 2001 From: simplonco Date: Sun, 15 Jan 2023 00:21:12 +0100 Subject: [PATCH 2/7] separate password add --- .../api_back/src/chat/chat.controller.ts | 21 +++++- .../nestjs/api_back/src/chat/chat.service.ts | 71 ++++++++++++++----- 2 files changed, 70 insertions(+), 22 deletions(-) diff --git a/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts b/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts index 33dcf948..b87d18c5 100644 --- a/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts +++ b/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts @@ -123,19 +123,27 @@ export class ChatController { throw new HttpException({ error: true, code: 'FORBIDDEN_CHARACTERS', message: `Your room name can not contains these characters : ${forbidden_chars}` }, HttpStatus.UNPROCESSABLE_ENTITY); } + // check for password protection if (typeof room.protection === 'undefined') room.protection = false; else if (room.protection === true) { if (!room.password || room.password.length === 0) { - printCaller(`throw error: error: true, code: 'PASSWORD_TOO_SHORT', message: 'your password is too short'`); - throw new HttpException({ error: true, code: 'PASSWORD_TOO_SHORT', message: `your password is too short` }, HttpStatus.UNPROCESSABLE_ENTITY); + printCaller(`throw error: error: true, code: 'PASSWORD_INVALID', message: 'your password is invalid'`); + throw new HttpException({ error: true, code: 'PASSWORD_INVALID', message: `your password is invalid` }, HttpStatus.UNPROCESSABLE_ENTITY); } } + room.users = [req.user.username]; await this.chatService.addUserToNewRoom(req.user.username, room); + if (room.protection) + { + let socket: socketDto = this.chatGateway.sockets.get(req.user.username); + await this.chatService.addPassword(req.user.username, room, socket); + } + const ret_room = this.format_room(room); res.status(HttpStatus.OK).json({ room: ret_room }); printCaller("- out "); @@ -195,7 +203,14 @@ export class ChatController { printCaller("- in "); let fields = ["protection", "allowed_users"]; - const room_db = await this.chatService.getRoomByName(room.name, fields); + //const room_db = await this.chatService.getRoomByName(room.name, fields); + const room_db = await this.chatService.getRoomByName(room.name); + + console.log("room.name:", room.name); + console.log("room_db:", room_db); + const all_rooms = await this.chatService.getAllRooms(); + console.log("all_rooms:", all_rooms); + if (room_db.protection === true) { if (!room_db.allowed_users.includes(req.user.username)) 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 29897b88..d6001b6d 100644 --- a/srcs/requirements/nestjs/api_back/src/chat/chat.service.ts +++ b/srcs/requirements/nestjs/api_back/src/chat/chat.service.ts @@ -221,19 +221,6 @@ export class ChatService { throw new HttpException({ error: true, code: 'ROOM_CONFLICT', message: `This room name already exist` }, HttpStatus.CONFLICT); } - let hash; - if (room.protection) - { - if (room.type === 'direct') - { - console.log("throw error: error: true, code: 'DIRECT_PASSWORD_FORBIDDEN', message: 'you cannot set a password in a direct message room'"); - throw new HttpException({ error: true, code: 'DIRECT_PASSWORD_FORBIDDEN', message: `you cannot set a password in a direct message room`}, HttpStatus.FORBIDDEN); - } - const saltOrRounds = 10; - const password = room.password; - hash = await bcrypt.hash(password, saltOrRounds); - } - // create chatroom let newChatroom = new Chatroom(); newChatroom.name = room.name; @@ -241,12 +228,7 @@ export class ChatService { newChatroom.owner = username; newChatroom.users = room.users; newChatroom.allowed_users = []; - newChatroom.protection = room.protection; - if (room.protection) - { - newChatroom.hash = hash; - newChatroom.allowed_users.push(username); - } + newChatroom.protection = false; newChatroom.messages = [ { name: "SERVER", message: `creation of room ${room.name}` }, @@ -270,6 +252,57 @@ export class ChatService { return room; } + async addPassword(username: string, room: roomDto, socket:socketDto, old_password?: string): Promise + { + printCaller("-- in "); + + if (room.type === 'direct') + { + console.log("throw error: error: true, code: 'DIRECT_PASSWORD_FORBIDDEN', message: 'you cannot set a password in a direct message room'"); + throw new HttpException({ error: true, code: 'DIRECT_PASSWORD_FORBIDDEN', message: `you cannot set a password in a direct message room` }, HttpStatus.FORBIDDEN); + } + + const current_room = await this.getRoomByName(room.name); + + let message = `${username} set a new password`; + + if (current_room.protection) + { + if (!old_password) + { + console.log("throw error: error: true, code: 'MISSING_OLD_PASSWORD', message: 'you need to provide the old password to set a new one'"); + throw new HttpException({ error: true, code: 'MISSING_OLD_PASSWORD', message: `you need to provide the old password to set a new one` }, HttpStatus.FORBIDDEN); + } + const is_match = await bcrypt.compare(old_password, current_room.hash); + if (!is_match) + { + printCaller(`throw error: error: true, code: 'BAD_PASSWORD', message: 'you provided a bad password'`); + throw new HttpException({ error: true, code: 'BAD_PASSWORD', message: `you provided a bad password` }, HttpStatus.BAD_REQUEST); + } + } + + const saltOrRounds = 10; + const password = room.password; + let hash = await bcrypt.hash(password, saltOrRounds); + + // add password to chatroom + if (!current_room.allowed_users.includes(username)) + current_room.allowed_users.push(username); + current_room.protection = true; + current_room.hash = hash; + current_room.messages.push({ name: "SERVER", message: message }); + await this.chatroomRepository.save(current_room); + + console.log("current_room:", current_room); + const all_rooms = await this.getAllRooms(); + console.log("all_rooms:", all_rooms); + + // inform other connected users + await socket.to(socket.room).emit('message', "SERVER", message); + + printCaller("-- out "); + } + async addMessageToRoom(room_name: string, username: string, message: string): Promise { printCaller("-- in "); From 1a7091679b7a94ed19109b4a3358f5812ce87d30 Mon Sep 17 00:00:00 2001 From: simplonco Date: Sun, 15 Jan 2023 01:05:57 +0100 Subject: [PATCH 3/7] wip change password + little clean in files, delete some --- .../api_back/src/chat/chat.controller.ts | 27 ++++++++++----- .../api_front/src/pieces/chat/Chat.svelte | 2 +- .../src/pieces/chat/Chat_layouts.svelte | 17 +++++----- .../src/pieces/chat/Layout_home.svelte | 2 +- .../src/pieces/chat/Layout_new.svelte | 2 +- ...rotected.svelte => Layout_password.svelte} | 34 ++++++++++++------- .../src/pieces/chat/Layout_room_set.svelte | 21 ++---------- .../src/pieces/chat/Request_rooms.ts | 2 +- .../chat/{Socket_init.ts => Socket_chat.ts} | 21 ++++++++++-- .../src/pieces/chat/Socket_events.ts | 12 ------- .../src/pieces/chat/tmp_debug.svelte | 27 --------------- 11 files changed, 74 insertions(+), 93 deletions(-) rename srcs/requirements/svelte/api_front/src/pieces/chat/{Layout_protected.svelte => Layout_password.svelte} (62%) rename srcs/requirements/svelte/api_front/src/pieces/chat/{Socket_init.ts => Socket_chat.ts} (81%) delete mode 100644 srcs/requirements/svelte/api_front/src/pieces/chat/Socket_events.ts delete mode 100644 srcs/requirements/svelte/api_front/src/pieces/chat/tmp_debug.svelte diff --git a/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts b/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts index b87d18c5..4f789b25 100644 --- a/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts +++ b/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts @@ -203,13 +203,7 @@ export class ChatController { printCaller("- in "); let fields = ["protection", "allowed_users"]; - //const room_db = await this.chatService.getRoomByName(room.name, fields); - const room_db = await this.chatService.getRoomByName(room.name); - - console.log("room.name:", room.name); - console.log("room_db:", room_db); - const all_rooms = await this.chatService.getAllRooms(); - console.log("all_rooms:", all_rooms); + const room_db = await this.chatService.getRoomByName(room.name, fields); if (room_db.protection === true) { @@ -231,8 +225,8 @@ export class ChatController { @UseGuards(AuthenticateGuard) @UseGuards(TwoFactorGuard) - @Post('password') - async setPassword(@Body() room: roomDto, @Req() req, @Res() res): Promise + @Post('passwordauth') + async passwordAuthentication(@Body() room: roomDto, @Req() req, @Res() res): Promise { printCaller("- in "); @@ -254,6 +248,21 @@ export class ChatController { printCaller("- out "); } + @UseGuards(AuthenticateGuard) + @UseGuards(TwoFactorGuard) + @Post('changepassword') + async changePassword(@Body('room') room: roomDto, @Body('old_password') old_password: string, @Req() req, @Res() res): Promise + { + printCaller("- in "); + + let socket: socketDto = this.chatGateway.sockets.get(req.user.username); + await this.chatService.addPassword(req.user.username, room, socket, old_password); + + const ret_room = this.format_room(room); + res.status(HttpStatus.OK).json({ room: ret_room }); + printCaller("- out "); + } + @UseGuards(AuthenticateGuard) @UseGuards(TwoFactorGuard) @Post('invite') diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Chat.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Chat.svelte index 06b2ef15..ad691fc8 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Chat.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Chat.svelte @@ -1,7 +1,7 @@ - -
-

temp, for testing :

- - - - - - - - - - - -
From f364d82f8e35d81eb9fe69448b2b279b26ccee41 Mon Sep 17 00:00:00 2001 From: simplonco Date: Sun, 15 Jan 2023 01:08:39 +0100 Subject: [PATCH 4/7] forgot to add : deleted temp buttons to access layout in front --- .../svelte/api_front/src/pieces/chat/Layout_password.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_password.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_password.svelte index 217ea1c0..95524f5e 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_password.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_password.svelte @@ -8,6 +8,7 @@ export let back = ""; export let mode = "add"; + let password_state = ""; if (mode === 'change') password_state = "new"; From 4342da67498a61fe87e6dfb7846dcef4f476524b Mon Sep 17 00:00:00 2001 From: simplonco Date: Sun, 15 Jan 2023 02:11:45 +0100 Subject: [PATCH 5/7] modify password ok --- README.md | 2 +- .../api_back/src/chat/chat.controller.ts | 55 ++++++++- .../nestjs/api_back/src/chat/chat.service.ts | 105 +++++++++--------- .../src/pieces/chat/Chat_layouts.svelte | 3 + .../src/pieces/chat/Layout_password.svelte | 22 +++- .../src/pieces/chat/Layout_room_set.svelte | 2 +- .../src/pieces/chat/Request_rooms.ts | 46 +++++++- .../api_front/src/pieces/chat/Types_chat.ts | 2 +- 8 files changed, 171 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index df043e84..300c2d9d 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ - [/] leave room - [/] leave direct impossible - [/] protect room with password -- [ ] add and change password in room +- [/] add, change, and remove password in room - [ ] make admin - [ ] ban - [ ] mute diff --git a/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts b/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts index 4f789b25..a2570d8d 100644 --- a/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts +++ b/srcs/requirements/nestjs/api_back/src/chat/chat.controller.ts @@ -140,8 +140,11 @@ export class ChatController { if (room.protection) { + let message = `${req.user.username} changed the password`; + room.allowed_users = [req.user.username]; + await this.chatService.setPassword(req.user.username, message, room); let socket: socketDto = this.chatGateway.sockets.get(req.user.username); - await this.chatService.addPassword(req.user.username, room, socket); + await socket.to(socket.room).emit('message', "SERVER", message); } const ret_room = this.format_room(room); @@ -255,8 +258,56 @@ export class ChatController { { printCaller("- in "); + let message = `${req.user.username} changed the password`; + room.allowed_users = [req.user.username]; + room.protection = true; + await this.chatService.setPassword(req.user.username, message, room, old_password); + + // inform other connected users let socket: socketDto = this.chatGateway.sockets.get(req.user.username); - await this.chatService.addPassword(req.user.username, room, socket, old_password); + await socket.to(socket.room).emit('message', "SERVER", message); + + const ret_room = this.format_room(room); + res.status(HttpStatus.OK).json({ room: ret_room }); + printCaller("- out "); + } + + @UseGuards(AuthenticateGuard) + @UseGuards(TwoFactorGuard) + @Post('addpassword') + async addPassword(@Body() room: roomDto, @Req() req, @Res() res): Promise + { + printCaller("- in "); + + let message = `${req.user.username} added a password`; + room.allowed_users = [req.user.username]; + room.protection = true; + await this.chatService.setPassword(req.user.username, message, room); + + // inform other connected users + let socket: socketDto = this.chatGateway.sockets.get(req.user.username); + await socket.to(socket.room).emit('message', "SERVER", message); + + const ret_room = this.format_room(room); + res.status(HttpStatus.OK).json({ room: ret_room }); + printCaller("- out "); + } + + @UseGuards(AuthenticateGuard) + @UseGuards(TwoFactorGuard) + @Delete('removepassword') + async removePassword(@Body() room: roomDto, @Req() req, @Res() res): Promise + { + printCaller("- in "); + + let message = `${req.user.username} removed a new password`; + room.allowed_users = []; + room.protection = false; + await this.chatService.setPassword(req.user.username, message, room); + + // inform other connected users + let socket: socketDto = this.chatGateway.sockets.get(req.user.username); + await socket.to(socket.room).emit('message', "SERVER", message); const ret_room = this.format_room(room); res.status(HttpStatus.OK).json({ room: ret_room }); 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 d6001b6d..e094920f 100644 --- a/srcs/requirements/nestjs/api_back/src/chat/chat.service.ts +++ b/srcs/requirements/nestjs/api_back/src/chat/chat.service.ts @@ -206,6 +206,60 @@ export class ChatService { await this.chatroomRepository.save(room_db); } + async setPassword(username: string, message: string, room: roomDto, old_password?: string): Promise + { + printCaller("-- in "); + + if (room.type === 'direct') + { + console.log("throw error: error: true, code: 'DIRECT_PASSWORD_FORBIDDEN', message: 'you cannot set a password in a direct message room'"); + throw new HttpException({ error: true, code: 'DIRECT_PASSWORD_FORBIDDEN', message: `you cannot set a password in a direct message room` }, HttpStatus.FORBIDDEN); + } + + const current_room = await this.getRoomByName(room.name); + + if (!room.password) + { + console.log("throw error: error: true, code: 'NO_PASSWORD', message: 'this room has no password protection'"); + throw new HttpException({ error: true, code: 'NO_PASSWORD', message: `this room has no password protection` }, HttpStatus.FORBIDDEN); + } + if (current_room.protection) + { + if (room.protection && !old_password) + { + console.log("throw error: error: true, code: 'MISSING_OLD_PASSWORD', message: 'you need to provide the old password to set a new one'"); + throw new HttpException({ error: true, code: 'MISSING_OLD_PASSWORD', message: `you need to provide the old password to set a new one` }, HttpStatus.FORBIDDEN); + } + if (old_password) + { + const is_match = await bcrypt.compare(old_password, current_room.hash); + if (!is_match) + { + printCaller(`throw error: error: true, code: 'BAD_PASSWORD', message: 'you provided a bad password'`); + throw new HttpException({ error: true, code: 'BAD_PASSWORD', message: `you provided a bad password` }, HttpStatus.BAD_REQUEST); + } + } + } + + const saltOrRounds = 10; + const password = room.password; + let hash: string; + if (room.protection) + hash = await bcrypt.hash(password, saltOrRounds); + + // add password to chatroom + current_room.allowed_users = room.allowed_users; + current_room.protection = room.protection; + if (room.protection) + current_room.hash = hash; + else + delete current_room.hash; + current_room.messages.push({ name: "SERVER", message: message }); + await this.chatroomRepository.save(current_room); + + printCaller("-- out "); + } + /* ADDERS ************************************************* */ @@ -252,57 +306,6 @@ export class ChatService { return room; } - async addPassword(username: string, room: roomDto, socket:socketDto, old_password?: string): Promise - { - printCaller("-- in "); - - if (room.type === 'direct') - { - console.log("throw error: error: true, code: 'DIRECT_PASSWORD_FORBIDDEN', message: 'you cannot set a password in a direct message room'"); - throw new HttpException({ error: true, code: 'DIRECT_PASSWORD_FORBIDDEN', message: `you cannot set a password in a direct message room` }, HttpStatus.FORBIDDEN); - } - - const current_room = await this.getRoomByName(room.name); - - let message = `${username} set a new password`; - - if (current_room.protection) - { - if (!old_password) - { - console.log("throw error: error: true, code: 'MISSING_OLD_PASSWORD', message: 'you need to provide the old password to set a new one'"); - throw new HttpException({ error: true, code: 'MISSING_OLD_PASSWORD', message: `you need to provide the old password to set a new one` }, HttpStatus.FORBIDDEN); - } - const is_match = await bcrypt.compare(old_password, current_room.hash); - if (!is_match) - { - printCaller(`throw error: error: true, code: 'BAD_PASSWORD', message: 'you provided a bad password'`); - throw new HttpException({ error: true, code: 'BAD_PASSWORD', message: `you provided a bad password` }, HttpStatus.BAD_REQUEST); - } - } - - const saltOrRounds = 10; - const password = room.password; - let hash = await bcrypt.hash(password, saltOrRounds); - - // add password to chatroom - if (!current_room.allowed_users.includes(username)) - current_room.allowed_users.push(username); - current_room.protection = true; - current_room.hash = hash; - current_room.messages.push({ name: "SERVER", message: message }); - await this.chatroomRepository.save(current_room); - - console.log("current_room:", current_room); - const all_rooms = await this.getAllRooms(); - console.log("all_rooms:", all_rooms); - - // inform other connected users - await socket.to(socket.room).emit('message', "SERVER", message); - - printCaller("-- out "); - } - async addMessageToRoom(room_name: string, username: string, message: string): Promise { printCaller("-- in "); diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Chat_layouts.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Chat_layouts.svelte index 68f4fe16..55ae3216 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Chat_layouts.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Chat_layouts.svelte @@ -67,6 +67,9 @@ {:else if $layout === "password"} + + + {:else if $layout === "add_password"} {:else if $layout === "change_password"} diff --git a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_password.svelte b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_password.svelte index 95524f5e..d2d87f92 100644 --- a/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_password.svelte +++ b/srcs/requirements/svelte/api_front/src/pieces/chat/Layout_password.svelte @@ -1,13 +1,13 @@ -

We are sorry!

-

This isn't a url that we use.

-

Go home you're drunk.

- -

Take me home →

-
\ No newline at end of file + +
+
+

We are sorry!

+

This isn't a url that we use.

+

Go home you're drunk.

+
+
+ + \ No newline at end of file diff --git a/srcs/requirements/svelte/api_front/src/pages/SplashPage.svelte b/srcs/requirements/svelte/api_front/src/pages/SplashPage.svelte index 996728b8..f3dccddf 100644 --- a/srcs/requirements/svelte/api_front/src/pages/SplashPage.svelte +++ b/srcs/requirements/svelte/api_front/src/pages/SplashPage.svelte @@ -78,8 +78,8 @@ .button-in { background-color: #8c0000; - border-color: black; - border-width: 4px; + border-color: #071013; + border-width: 2px; color: white; font-family: "Bit5x3"; font-size: x-large; @@ -88,8 +88,8 @@ .button-out { background-color: #008c8c; - border-color: black; - border-width: 4px; + border-color: #071013; + border-width: 2px; color: white; font-family: "Bit5x3"; font-size: x-large; diff --git a/srcs/requirements/svelte/api_front/src/pages/game/Ranking.svelte b/srcs/requirements/svelte/api_front/src/pages/game/Ranking.svelte index 5585b051..af39892f 100644 --- a/srcs/requirements/svelte/api_front/src/pages/game/Ranking.svelte +++ b/srcs/requirements/svelte/api_front/src/pages/game/Ranking.svelte @@ -28,7 +28,7 @@

- +
@@ -59,6 +59,7 @@
+
diff --git a/srcs/requirements/svelte/api_front/src/pages/profile/ProfileFriends.svelte b/srcs/requirements/svelte/api_front/src/pages/profile/ProfileFriends.svelte index 71c780c6..8dc48d37 100644 --- a/srcs/requirements/svelte/api_front/src/pages/profile/ProfileFriends.svelte +++ b/srcs/requirements/svelte/api_front/src/pages/profile/ProfileFriends.svelte @@ -24,22 +24,10 @@ onMount( async() => { - // DO I ACTUALLY NEED TO ON MOUNT ALL THIS STUFF? - // ALSO I COULD JUST USE THE FUNCITONS I MADE... - - - // yea no idea what - // i mean do i fetch user? i will for now user = await fetch(`http://${process.env.WEBSITE_HOST}:${process.env.WEBSITE_PORT}/api/v2/user`) .then( (x) => x.json() ); fetchAll(); - // ok this shit works! - // const interval = setInterval(() => { - // fetchAll(); - // }, 1000); - - // return () => clearInterval(interval); }); const fetchAll = async() => { @@ -234,6 +222,7 @@ +
@@ -353,7 +342,7 @@
- +
From fa8e3d74730f15655bb35e99a9614459106b21e6 Mon Sep 17 00:00:00 2001 From: cherif Date: Sun, 15 Jan 2023 18:07:23 +0100 Subject: [PATCH 7/7] changements de le couleur et de la font sur l'ensemble du site. --- .../svelte/api_front/src/pages/profile/ProfileSettings.svelte | 1 + 1 file changed, 1 insertion(+) 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 577fdc17..738dd392 100644 --- a/srcs/requirements/svelte/api_front/src/pages/profile/ProfileSettings.svelte +++ b/srcs/requirements/svelte/api_front/src/pages/profile/ProfileSettings.svelte @@ -193,6 +193,7 @@ .inline-check{ display: inline; + color: #333; }