From afa4ad79159265b6dd09622547082e850a8b6cad Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 29 Apr 2024 11:10:41 +0100 Subject: [PATCH] Remove logging succesful authentications - fills logs with useless lines Signed-off-by: Fred Boniface --- src/middlewares/auth.middlewares.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/middlewares/auth.middlewares.ts b/src/middlewares/auth.middlewares.ts index 3eea2eb..150eeca 100644 --- a/src/middlewares/auth.middlewares.ts +++ b/src/middlewares/auth.middlewares.ts @@ -21,21 +21,19 @@ module.exports = async function authCheck( } else if (typeof id === "string") { const authCheck = (await isAuthed(id)) || false; if (authCheck) { + // Authenticate req.isAuthed = true; - logger.info("auth.middleware: Authentication Successful"); next(); } else { req.isAuthed = false; logger.info("auth.middleware: Authentication Failed"); next(); } + // Handle cases where UUID passed as an array } else if (Array.isArray(id)) { const authCheck = (await isAuthed(id[0])) || false; if (authCheck) { req.isAuthed = true; - logger.warn( - "auth.middleware: UUID Passed as Array - Authentication Successful" - ); next(); } else { req.isAuthed = false;