1
0
mirror of https://github.com/eleith/emailjs.git synced 2024-07-07 12:40:37 +00:00

smtp/smtp: error on password without user

This commit is contained in:
Zack Schuster 2020-05-25 23:34:54 -07:00
parent 265b88a046
commit 2ce27a2b9b

View File

@ -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;