From f1437f16a9abb95a6fc09cff1cda7ebb7ed7176c Mon Sep 17 00:00:00 2001 From: Jack Foltz Date: Wed, 26 Dec 2018 19:30:42 -0500 Subject: [PATCH] Use ip instead of remoteAddress for logging --- app/routes/api/auth.js | 4 ++-- app/util/auth.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/routes/api/auth.js b/app/routes/api/auth.js index 1fda18d..f13be3c 100644 --- a/app/routes/api/auth.js +++ b/app/routes/api/auth.js @@ -36,7 +36,7 @@ const validateInvite = wrap(async (req, res, next) => { if (!invite) { // Log failure - await fs.appendFile('auth.log', `${new Date().toISOString()} register ${req.connection.remoteAddress}\n`); + await fs.appendFile('auth.log', `${new Date().toISOString()} register ${req.ip}\n`); return res.status(422).json({message: 'Invalid invite code.'}); } @@ -98,7 +98,7 @@ router.post('/login', bodyVerifier(loginProps), canonicalizeRequest, wrap(async const user = await authenticate(req, res, next); if (!user) { // Log failure - await fs.appendFile('auth.log', `${new Date().toISOString()} login ${req.connection.remoteAddress}\n`); + await fs.appendFile('auth.log', `${new Date().toISOString()} login ${req.ip}\n`); return res.status(401).json({'message': 'Unauthorized.'}); } diff --git a/app/util/auth.js b/app/util/auth.js index 0f278b4..9b6cfab 100644 --- a/app/util/auth.js +++ b/app/util/auth.js @@ -33,7 +33,7 @@ const checkKey = async (req, scope, status) => { } } else { // Log failure - await fs.appendFile('auth.log', `${new Date().toISOString()} key ${req.connection.remoteAddress}\n`); + await fs.appendFile('auth.log', `${new Date().toISOString()} key ${req.ip}\n`); } } };