mirror of
https://hk.gh-proxy.com/https://github.com/NodeBB/nodebb-plugin-write-api.git
synced 2025-10-03 04:21:06 +08:00
fix: crash #425 req.body can be undefined
This commit is contained in:
parent
6886a5e385
commit
9c8840d4cd
1 changed files with 3 additions and 1 deletions
|
@ -37,7 +37,9 @@ const passportAuthenticateAsync = function (req, res) {
|
|||
|
||||
Middleware.requireUser = async function (req, res, next) {
|
||||
var writeApi = require.main.require('nodebb-plugin-write-api');
|
||||
var token = (writeApi.settings['jwt:payloadKey'] ? (req.query[writeApi.settings['jwt:payloadKey']] || req.body[writeApi.settings['jwt:payloadKey']]) : null) || req.query.token || req.body.token;
|
||||
const query = req.query || {};
|
||||
const body = req.body || {};
|
||||
var token = (writeApi.settings['jwt:payloadKey'] ? (query[writeApi.settings['jwt:payloadKey']] || body[writeApi.settings['jwt:payloadKey']]) : null) || query.token || body.token;
|
||||
const loginAsync = util.promisify(req.login).bind(req);
|
||||
var routeMatch;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue