add ip to invalid token log

This commit is contained in:
2023-05-02 13:37:15 +02:00
parent ba1f771b0b
commit 8b5091f483
+3 -1
View File
@@ -23,7 +23,9 @@ router.post(
}
const query = await CheckServerToken(req.headers.authorization.split(' ')[1])
if (!query || !query.id) {
console.error("incorrect token : " + req.headers.authorization.split(' ')[1] + " for " + req.body.servername)
console.error("incorrect token : " + req.headers.authorization.split(' ')[1] + " for " + req.body.servername + " with IP " + (req.headers['x-forwarded-for']?.toString() ||
req.socket.remoteAddress?.toString() ||
''))
return res.sendStatus(403)
}
next()