mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: update csrf parser to accept csrf_token form value if present
This commit is contained in:
@@ -9,8 +9,8 @@ const {
|
||||
getTokenFromRequest: (req) => {
|
||||
if (req.headers['x-csrf-token']) {
|
||||
return req.headers['x-csrf-token'];
|
||||
} else if (req.query) {
|
||||
return req.query._csrf;
|
||||
} else if (req.body.csrf_token) {
|
||||
return req.body.csrf_token;
|
||||
}
|
||||
},
|
||||
size: 64,
|
||||
|
||||
@@ -172,7 +172,7 @@ Auth.reloadRoutes = async function (params) {
|
||||
|
||||
router.post('/register', middlewares, controllers.authentication.register);
|
||||
router.post('/register/complete', middlewares, controllers.authentication.registerComplete);
|
||||
router.post('/register/abort', Auth.middleware.applyCSRF, controllers.authentication.registerAbort);
|
||||
router.post('/register/abort', middlewares, controllers.authentication.registerAbort);
|
||||
router.post('/login', Auth.middleware.applyCSRF, Auth.middleware.applyBlacklist, controllers.authentication.login);
|
||||
router.post('/logout', Auth.middleware.applyCSRF, controllers.authentication.logout);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user