mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
21 lines
453 B
CoffeeScript
21 lines
453 B
CoffeeScript
RateLimiter = require('../../infrastructure/RateLimiter')
|
|
|
|
|
|
ONE_MIN = 60
|
|
ATTEMPT_LIMIT = 10
|
|
|
|
|
|
module.exports =
|
|
|
|
processLoginRequest: (email, callback) ->
|
|
opts =
|
|
endpointName: 'login'
|
|
throttle: ATTEMPT_LIMIT
|
|
timeInterval: ONE_MIN * 2
|
|
subjectName: email
|
|
RateLimiter.addCount opts, (err, shouldAllow) ->
|
|
callback(err, shouldAllow)
|
|
|
|
recordSuccessfulLogin: (email, callback = ->)->
|
|
RateLimiter.clearRateLimit 'login', email, callback
|
|
|