wip: password reset routes

This commit is contained in:
GitBluub
2023-09-15 15:11:14 +02:00
parent 869b2e696f
commit 10f033fe78

View File

@@ -79,6 +79,22 @@ export class AuthController {
} }
} }
@HttpCode(200)
@UseGuards(JwtAuthGuard)
@Put('reset')
async password_reset(@Request() req: any, @Query('token') token: string): Promise<void> {
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<void> {
await this.authService.sendResetMail(req.user);
}
@HttpCode(200) @HttpCode(200)
@UseGuards(JwtAuthGuard) @UseGuards(JwtAuthGuard)
@Put('verify') @Put('verify')