wip change password
+ little clean in files, delete some
This commit is contained in:
@@ -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<void>
|
||||
@Post('passwordauth')
|
||||
async passwordAuthentication(@Body() room: roomDto, @Req() req, @Res() res): Promise<void>
|
||||
{
|
||||
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<void>
|
||||
{
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user