Bläddra i källkod

Add newline to auth logging

production
Jack Foltz 5 år sedan
förälder
incheckning
e4684384ea
Signerad av: foltik <jack@foltz.io> GPG-nyckel ID: D1F0331758D1F29A
2 ändrade filer med 3 tillägg och 3 borttagningar
  1. +2
    -2
      app/routes/api/auth.js
  2. +1
    -1
      app/util/auth.js

+ 2
- 2
app/routes/api/auth.js Visa fil

@@ -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}`);
await fs.appendFile('auth.log', `${new Date().toISOString()} register ${req.connection.remoteAddress}\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}`);
await fs.appendFile('auth.log', `${new Date().toISOString()} login ${req.connection.remoteAddress}\n`);
return res.status(401).json({'message': 'Unauthorized.'});
}



+ 1
- 1
app/util/auth.js Visa fil

@@ -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}`);
await fs.appendFile('auth.log', `${new Date().toISOString()} key ${req.connection.remoteAddress}\n`);
}
}
};


Laddar…
Avbryt
Spara