@@ -15,7 +15,6 @@ import {
15
15
import { UsersService } from "../users/users.service" ;
16
16
import { AuthService } from "./auth.service" ;
17
17
import { Response , Request as ExpressRequest } from "express" ;
18
- import { Throttle , ThrottlerGuard } from "@nestjs/throttler" ;
19
18
import { ApiResponse , ApiResponseOptions } from "@scholarsome/shared" ;
20
19
import { LoginDto } from "./dto/login.dto" ;
21
20
import { RegisterDto } from "./dto/register.dto" ;
@@ -24,32 +23,24 @@ import * as jwt from "jsonwebtoken";
24
23
import { ConfigService } from "@nestjs/config" ;
25
24
import * as bcrypt from "bcrypt" ;
26
25
import { MailService } from "../providers/mail/mail.service" ;
27
- import { RedisService } from "@liaoliaots/nestjs-redis" ;
28
- import Redis from "ioredis" ;
29
- import { JwtService } from "@nestjs/jwt" ;
30
26
import { User } from "@prisma/client" ;
31
27
import { ApiExcludeController , ApiTags } from "@nestjs/swagger" ;
28
+ import { Throttle , ThrottlerGuard } from "@nestjs/throttler" ;
32
29
33
30
@ApiTags ( "Authentication" )
34
31
@ApiExcludeController ( )
35
32
@UseGuards ( ThrottlerGuard )
36
33
@Controller ( "auth" )
37
34
export class AuthController {
38
- private readonly redis : Redis ;
39
-
40
35
/**
41
36
* @ignore
42
37
*/
43
38
constructor (
44
39
private readonly usersService : UsersService ,
45
40
private readonly authService : AuthService ,
46
41
private readonly configService : ConfigService ,
47
- private readonly mailService : MailService ,
48
- private readonly jwtService : JwtService ,
49
- private readonly redisService : RedisService
50
- ) {
51
- this . redis = this . redisService . getClient ( ) ;
52
- }
42
+ private readonly mailService : MailService
43
+ ) { }
53
44
54
45
/*
55
46
* Password reset routes
@@ -145,10 +136,10 @@ export class AuthController {
145
136
/**
146
137
* Sends a password reset for a given user
147
138
*
148
- * @remarks Throttled to 1 request per minute
139
+ * @remarks Throttled to 1 request per 5 seconds
149
140
* @returns Success response
150
141
*/
151
- @Throttle ( 5 , 60000 )
142
+ @Throttle ( 1 , 5 )
152
143
@Get ( "reset/sendReset/:email" )
153
144
async sendReset (
154
145
@Param ( ) params : { email : string }
@@ -262,10 +253,10 @@ export class AuthController {
262
253
/**
263
254
* Registers a new user
264
255
*
265
- * @remarks Throttled to 1 request per 3 minutes
256
+ * @remarks Throttled to 1 request per 5 seconds
266
257
* @returns Success response
267
258
*/
268
- @Throttle ( 5 , 180000 )
259
+ @Throttle ( 1 , 5 )
269
260
@Post ( "register" )
270
261
async register (
271
262
@Body ( ) registerDto : RegisterDto ,
0 commit comments