From ab8fc67cdbff091feccbe0f826c2c624f2121dc8 Mon Sep 17 00:00:00 2001 From: mohamad khawam Date: Mon, 11 Mar 2024 14:06:40 -0400 Subject: [PATCH] Updated logs --- src/modules/password/change_password_windows.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/password/change_password_windows.ts b/src/modules/password/change_password_windows.ts index b22a5f4..cb3eecf 100644 --- a/src/modules/password/change_password_windows.ts +++ b/src/modules/password/change_password_windows.ts @@ -8,11 +8,12 @@ import { getOutput, runCommand } from "../util/run_command"; async function changePasswordWin(server: Server, user: User, conn: SSH2CONN | false, username: string, password: string) { var then = new Date(); + let headers = `[${server.ipaddress}] [${server.Name}] [${user.username}]`; if (!conn) { try { return await LDAPChangePassword(user, password); } catch (error: any) { - logger.log(`[${server.ipaddress}] [${server.Name}] [${user.username}] error ${error.message}`, "error"); + logger.log(`${headers} error ${error.message}`, "error"); return error.message ? (error as Error) : (error.message as string); } } @@ -31,8 +32,8 @@ async function changePasswordWin(server: Server, user: User, conn: SSH2CONN | fa try { return await LDAPChangePassword(user, password); } catch (error: any) { - logger.log(`[${server.ipaddress}] [${server.Name}] [${user.username}] LDAP Connection ${error.message}`, "warn"); - conn.log("Fallback ssh"); + logger.log(`${headers} LDAP Connection ${error.message}`, "warn"); + conn.log("Falling back to ssh"); return await changePasswordWinAD(conn, stripDomain(username), password); } }