From 340bfd7377467086c5cb8e76227b23d1e09b0518 Mon Sep 17 00:00:00 2001 From: Brad Koehn Date: Fri, 24 Jan 2025 11:58:34 -0600 Subject: [PATCH] Added changes from review --- server/monitor-types/smtp.js | 30 +++--------------------------- src/lang/en.json | 3 ++- src/pages/EditMonitor.vue | 4 ++-- 3 files changed, 7 insertions(+), 30 deletions(-) diff --git a/server/monitor-types/smtp.js b/server/monitor-types/smtp.js index 3026dc2df..e5f67157d 100644 --- a/server/monitor-types/smtp.js +++ b/server/monitor-types/smtp.js @@ -5,30 +5,6 @@ const nodemailer = require("nodemailer"); class SMTPMonitorType extends MonitorType { name = "smtp"; - /** - * @param {*} smtpSecurity the user's SMTP security setting - * @returns {boolean} True if this should test SMTPS - */ - isSMTPS(smtpSecurity) { - return smtpSecurity === "secure"; - } - - /** - * @param {*} smtpSecurity the user's SMTP security setting - * @returns {boolean} True if this should not attempt STARTTLS, even if it is available - */ - isIgnoreTLS(smtpSecurity) { - return smtpSecurity === "nostarttls"; - } - - /** - * @param {*} smtpSecurity the user's SMTP security setting - * @returns {boolean} True if this should always test STARTTLS - */ - isRequireTLS(smtpSecurity) { - return smtpSecurity === "starttls"; - } - /** * @inheritdoc */ @@ -36,9 +12,9 @@ class SMTPMonitorType extends MonitorType { let options = { port: monitor.port || 25, host: monitor.hostname, - secure: this.isSMTPS(monitor.smtpSecurity), // use SMTPS (not STARTTLS) - ignoreTLS: this.isIgnoreTLS(monitor.smtpSecurity), // don't use STARTTLS even if it's available - requireTLS: this.isRequireTLS(monitor.smtpSecurity), // use STARTTLS or fail + secure: smtpSecurity === "secure", // use SMTPS (not STARTTLS) + ignoreTLS: smtpSecurity === "nostarttls", // don't use STARTTLS even if it's available + requireTLS: smtpSecurity === "starttls", // use STARTTLS or fail }; let transporter = nodemailer.createTransport(options); try { diff --git a/src/lang/en.json b/src/lang/en.json index e215f1031..b324f9f78 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1051,5 +1051,6 @@ "RabbitMQ Password": "RabbitMQ Password", "rabbitmqHelpText": "To use the monitor, you will need to enable the Management Plugin in your RabbitMQ setup. For more information, please consult the {rabitmq_documentation}.", "SendGrid API Key": "SendGrid API Key", - "Separate multiple email addresses with commas": "Separate multiple email addresses with commas" + "Separate multiple email addresses with commas": "Separate multiple email addresses with commas", + "smtpHelpText": "Specify the TLS settings of the SMTP server you wish to monitor: SMTPS, STARTTLS, or ignore TLS" } diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 0f597a349..bc3ef4224 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -332,14 +332,14 @@ -
+ -
+