mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -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
|
|
|