Skip to content

Commit

Permalink
Updated logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dominusmars committed Mar 11, 2024
1 parent 2cbfd4b commit ab8fc67
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/modules/password/change_password_windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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);
}
}
Expand Down

0 comments on commit ab8fc67

Please sign in to comment.