added severall protections

This commit is contained in:
simplonco
2023-01-16 17:43:13 +01:00
parent 5f0e733f55
commit 569ef89077
2 changed files with 9 additions and 2 deletions

View File

@@ -231,6 +231,13 @@ export class ChatController {
console.log("throw error: error: true, code: 'BLOCKED_USER', message: 'you cannot enter this room, you blocked this user'");
throw new HttpException({ error: true, code: 'BLOCKED_USER', message: `you cannot enter this room, you blocked this user` }, HttpStatus.UNAUTHORIZED);
}
const find_room = await this.chatService.getRoomByName(`${req.user.username} + ${room.name}`);
if (find_room)
{
console.log("throw error: error: true, code: 'ROOM_CONFLICT', message: 'This room name already exist'");
throw new HttpException({ error: true, code: 'ROOM_CONFLICT', message: `This room name already exist` }, HttpStatus.CONFLICT);
}
room.type = 'direct';
room.users = [room.name, req.user.username];
room.name += ` + ${req.user.username}`;

View File

@@ -10,10 +10,10 @@
let users: User[] = list_block_user();
function user_profile(room_user: string)
async function user_profile(room_user: string)
{
to_print("in user_profile");
settings_user.set(room_user);
await settings_user.set(room_user);
layout.set("user");
}