Skip to content

Commit

Permalink
Merge pull request #95 from Trendyol/76-login-rate-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ddenizakpinar authored Aug 4, 2023
2 parents ce9b199 + 136b490 commit c3d9986
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@nestjs/platform-express": "^9.0.3",
"@nestjs/schedule": "^2.1.0",
"@nestjs/swagger": "next",
"@nestjs/throttler": "^2.0.1",
"@nestjs/throttler": "^4.2.1",
"@trendyol-js/cdn": "^1.5.1",
"bcryptjs": "^2.4.3",
"class-transformer": "^0.5.1",
Expand Down
5 changes: 5 additions & 0 deletions backend/src/modules/session/session.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { ApiTags } from '@nestjs/swagger';
import { UserService } from '@modules/user/user.service';
import { GoogleGuard } from '@core/guards/google.guard';
import config from '@config';
import { Throttle } from '@nestjs/throttler';

@ApiTags('Session')
@Controller('session')
export class SessionController {
Expand All @@ -24,6 +26,7 @@ export class SessionController {
private readonly userService: UserService,
) {}

@Throttle(3, 60)
@Get('google/callback')
@UseGuards(GoogleGuard)
async googleAuthCallback(
Expand All @@ -46,6 +49,7 @@ export class SessionController {
return response.redirect(config.clientUrl);
}

@Throttle(3, 60)
@Post()
async createSession(
@Body() createSessionDto: CreateSessionDto,
Expand All @@ -62,6 +66,7 @@ export class SessionController {
return;
}

@Throttle(3, 60)
@UseGuards(JwtGuard)
@Post(':id')
async createSessionForUser(@Param('id') id: string) {
Expand Down
8 changes: 4 additions & 4 deletions backend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,10 @@
dependencies:
tslib "2.4.0"

"@nestjs/throttler@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@nestjs/throttler/-/throttler-2.0.1.tgz#97611c4bdffdb1df00fcaeb7ac55fcfee1864bf6"
integrity sha512-ginW73rmOjBN27USuGidetEoa8VSGzxW3kEuCquEd5mETEtBfgIm4901b9tuLDnsczttE01imCHZ53J7+AuLJg==
"@nestjs/throttler@^4.2.1":
version "4.2.1"
resolved "https://registry.yarnpkg.com/@nestjs/throttler/-/throttler-4.2.1.tgz#7a27bb3fed899396beab04648ed72b5c682fc61b"
integrity sha512-wVPMuIyr0KdrK1RVVQceWVNesogCm9IgYC1V5EkaTZ+usIE4qxEyzdwU5IqQLgOO/Loiq98MLwReDxazX7i9Uw==
dependencies:
md5 "^2.2.1"

Expand Down

0 comments on commit c3d9986

Please sign in to comment.