mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 07:55:46 +01:00
feat: require csrf token if not using bearer token
This commit is contained in:
@@ -34,6 +34,10 @@ module.exports = function (middleware) {
|
||||
const loginAsync = util.promisify(req.login).bind(req);
|
||||
|
||||
if (req.loggedIn) {
|
||||
if (res.locals.isAPI) {
|
||||
await middleware.applyCSRFasync(req, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (req.headers.hasOwnProperty('authorization')) {
|
||||
const user = await passportAuthenticateAsync(req, res);
|
||||
|
||||
Reference in New Issue
Block a user