Skip to content

Commit

Permalink
Return 429 if rate limit is triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekkio committed Nov 12, 2024
1 parent 2ea67e1 commit f48523f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apigw/src/enduser/routes/auth-weak-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export const authWeakLogin = (redis: RedisClient) =>
GET: true, // return previous value
NX: true // only set if key doesn't exist
})
if (previous) throw new Error('Login rate limit for user triggered')
if (previous) {
res.sendStatus(429)
return
}

const { id } = await citizenWeakLogin(body)
const user: EvakaSessionUser = {
Expand Down

0 comments on commit f48523f

Please sign in to comment.