mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #7294 from overleaf/jpa-ratelimit-2fa-check
[web] rate-limit 2fa check requests GitOrigin-RevId: da3d2f15c68cff101de807c1eae91edbd86481e7
This commit is contained in:
parent
b548d4e15b
commit
2117d24bda
1 changed files with 3 additions and 1 deletions
|
@ -16,8 +16,10 @@ const settings = require('@overleaf/settings')
|
|||
Unique clients are identified by user_id if logged in, and IP address if not.
|
||||
*/
|
||||
function rateLimit(opts) {
|
||||
const getUserId =
|
||||
opts.getUserId || (req => SessionManager.getLoggedInUserId(req.session))
|
||||
return function (req, res, next) {
|
||||
const userId = SessionManager.getLoggedInUserId(req.session) || req.ip
|
||||
const userId = getUserId(req) || req.ip
|
||||
if (
|
||||
settings.smokeTest &&
|
||||
settings.smokeTest.userId &&
|
||||
|
|
Loading…
Reference in a new issue