Skip to content

Commit

Permalink
smtp/smtp: error on password without user
Browse files Browse the repository at this point in the history
  • Loading branch information
zackschuster committed May 26, 2020
1 parent 265b88a commit 2ce27a2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions smtp/smtp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ export class SMTPConnection extends EventEmitter {
this.port = port || (ssl ? SMTP_SSL_PORT : tls ? SMTP_TLS_PORT : SMTP_PORT);
this.loggedin = user && password ? false : true;

if (!user && (password?.length ?? 0) > 0) {
throw new Error('`password` cannot be set without `user`');
}

// keep these strings hidden when quicky debugging/logging
this.user = () => user as string;
this.password = () => password as string;
Expand Down

0 comments on commit 2ce27a2

Please sign in to comment.