Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
adelsz committed Feb 27, 2023
1 parent efd1a63 commit c10095d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/query/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,13 @@ export async function startup(
throw new Error('SASL: No final SASL data returned');
}
} else if ('salt' in result) {
// hash password for md5 auth
password = generateHash(options.user, password, result.salt);
await queue.send(messages.passwordMessage, { password });
await queue.reply(messages.authenticationOk);
await queue.reply(messages.readyForQuery);
} else {
await queue.send(messages.passwordMessage, { password });
await queue.reply(messages.authenticationOk);
await queue.reply(messages.readyForQuery);
}
// handles both cleartext and md5 password auth
await queue.send(messages.passwordMessage, { password });
await queue.reply(messages.authenticationOk);
await queue.reply(messages.readyForQuery);
} catch (e) {
// tslint:disable-next-line:no-console
console.error(`Connection failed: ${(e as any).message}`);
Expand Down

0 comments on commit c10095d

Please sign in to comment.