diff --git a/back/src/auth/auth.controller.ts b/back/src/auth/auth.controller.ts index bc48297..c94ad1e 100644 --- a/back/src/auth/auth.controller.ts +++ b/back/src/auth/auth.controller.ts @@ -79,6 +79,22 @@ export class AuthController { } } + @HttpCode(200) + @UseGuards(JwtAuthGuard) + @Put('reset') + async password_reset(@Request() req: any, @Query('token') token: string): Promise { + if (await this.authService.resetPassword(req.user.id, token)) + return; + throw new BadRequestException("Invalid token. Expired or invalid."); + } + + @HttpCode(200) + @UseGuards(JwtAuthGuard) + @Put('send-reset') + async send_reset(@Request() req: any): Promise { + await this.authService.sendResetMail(req.user); + } + @HttpCode(200) @UseGuards(JwtAuthGuard) @Put('verify')