diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-31 11:44:07 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-31 11:44:44 +0200 |
commit | 288fe38590788fb737eb4280309846c76c51e7c3 (patch) | |
tree | 647f0df43657fd6ef04e91f107fd6f48ea82c9b4 /server/controllers/api | |
parent | 328e607d32d7f1e960f8966a70097b030e386ab4 (diff) | |
download | PeerTube-288fe38590788fb737eb4280309846c76c51e7c3.tar.gz PeerTube-288fe38590788fb737eb4280309846c76c51e7c3.tar.zst PeerTube-288fe38590788fb737eb4280309846c76c51e7c3.zip |
Use custom rate limiter when asking verif email
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/users/index.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 008c34ca4..01ee73a53 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -42,6 +42,12 @@ const loginRateLimiter = new RateLimit({ | |||
42 | delayMs: 0 | 42 | delayMs: 0 |
43 | }) | 43 | }) |
44 | 44 | ||
45 | const askSendEmailLimiter = new RateLimit({ | ||
46 | windowMs: RATES_LIMIT.ASK_SEND_EMAIL.WINDOW_MS, | ||
47 | max: RATES_LIMIT.ASK_SEND_EMAIL.MAX, | ||
48 | delayMs: 0 | ||
49 | }) | ||
50 | |||
45 | const usersRouter = express.Router() | 51 | const usersRouter = express.Router() |
46 | usersRouter.use('/', meRouter) | 52 | usersRouter.use('/', meRouter) |
47 | 53 | ||
@@ -114,7 +120,7 @@ usersRouter.post('/:id/reset-password', | |||
114 | ) | 120 | ) |
115 | 121 | ||
116 | usersRouter.post('/ask-send-verify-email', | 122 | usersRouter.post('/ask-send-verify-email', |
117 | loginRateLimiter, | 123 | askSendEmailLimiter, |
118 | asyncMiddleware(usersAskSendVerifyEmailValidator), | 124 | asyncMiddleware(usersAskSendVerifyEmailValidator), |
119 | asyncMiddleware(askSendVerifyUserEmail) | 125 | asyncMiddleware(askSendVerifyUserEmail) |
120 | ) | 126 | ) |