Skip to content

Commit a26755b

Browse files
committed
Align mw name with req.userKey ♻️
1 parent 2abd577 commit a26755b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

server/user/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const { authenticate, logout } = require('../shared/auth');
4-
const { loginRequestLimiter, resetLoginAttempts, setLoginLimitId } = require('./mw');
4+
const { loginRequestLimiter, resetLoginAttempts, setLoginLimitKey } = require('./mw');
55
const { ACCEPTED } = require('http-status-codes');
66
const { authorize } = require('../shared/auth/mw');
77
const ctrl = require('./user.controller');
@@ -14,7 +14,7 @@ const { User } = require('../shared/database');
1414
router
1515
.post(
1616
'/login',
17-
setLoginLimitId,
17+
setLoginLimitKey,
1818
loginRequestLimiter,
1919
authenticate('local', { setCookie: true }),
2020
resetLoginAttempts,

server/user/mw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const loginRequestLimiter = requestLimiter({
1010
keyGenerator: req => req.userKey
1111
});
1212

13-
function setLoginLimitId(req, res, next) {
13+
function setLoginLimitKey(req, res, next) {
1414
const key = [req.ip, req.body.email].join(':');
1515
req.userKey = crypto.createHash('sha256').update(key).digest('base64');
1616
return next();
@@ -21,4 +21,4 @@ function resetLoginAttempts(req, res, next) {
2121
.then(() => next());
2222
}
2323

24-
module.exports = { loginRequestLimiter, setLoginLimitId, resetLoginAttempts };
24+
module.exports = { loginRequestLimiter, setLoginLimitKey, resetLoginAttempts };

0 commit comments

Comments
 (0)