From b79c84a004d6c5932a710ab4b4fa9abd4ad0cd8a Mon Sep 17 00:00:00 2001 From: tone <3341154833@qq.com> Date: Thu, 19 Jun 2025 11:27:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E9=80=81=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E3=80=81=E7=99=BB=E9=99=86=E6=8E=A5=E5=8F=A3=E9=99=90=E6=B5=81?= =?UTF-8?q?20/min?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tone-page-server/src/auth/auth.controller.ts | 2 +- .../src/verification/verification.controller.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tone-page-server/src/auth/auth.controller.ts b/tone-page-server/src/auth/auth.controller.ts index 67c5841..4b9b12d 100644 --- a/tone-page-server/src/auth/auth.controller.ts +++ b/tone-page-server/src/auth/auth.controller.ts @@ -21,7 +21,7 @@ export class AuthController { @Post('login') @UseGuards(ThrottlerGuard) - @Throttle({ default: { limit: 100, ttl: 60000 } }) + @Throttle({ default: { limit: 20, ttl: 60000 } }) async login(@Body() loginDto: LoginDto) { switch (loginDto.type) { case 'password': diff --git a/tone-page-server/src/verification/verification.controller.ts b/tone-page-server/src/verification/verification.controller.ts index aa4905f..eb8f482 100644 --- a/tone-page-server/src/verification/verification.controller.ts +++ b/tone-page-server/src/verification/verification.controller.ts @@ -1,12 +1,15 @@ -import { BadRequestException, Body, Controller, Post } from '@nestjs/common'; +import { BadRequestException, Body, Controller, Post, UseGuards } from '@nestjs/common'; import { SendVerificationCodeDto } from './dto/send-verification-code.dto'; import { VerificationService } from './verification.service'; +import { Throttle, ThrottlerGuard } from '@nestjs/throttler'; @Controller('verification') export class VerificationController { - constructor(private readonly verificationService: VerificationService) {} + constructor(private readonly verificationService: VerificationService) { } @Post('send') + @UseGuards(ThrottlerGuard) + @Throttle({ default: { limit: 20, ttl: 60000 } }) async sendVerificationCode(@Body() dto: SendVerificationCodeDto) { switch (dto.type) { case 'login':