TLS Options Set Up

This commit is contained in:
Br0wnHammer committed 2025-06-11 15:11:28 +05:30
1 parent 01ed3d8aaa
commit 7e1a7066fc
3 files changed
+18 -3

No files matched your search

+6 -2
View File
@@ -56,17 +56,21 @@ const Settings = () => {
// Handlers // Handlers
const handleChange = async (e) => { const handleChange = async (e) => {
const { name, value } = e.target; const { name, value, checked } = e.target;
// Special case for showURL until handled properly in the backend // Special case for showURL until handled properly in the backend
if (name === "showURL") { if (name === "showURL") {
dispatch(setShowURL(value)); dispatch(setShowURL(value));
return; return;
} }
let newValue;
if (name === "systemEmailIgnoreTLS" || name === "systemEmailRequireTLS" || name === "systemEmailRejectUnauthorized") {
newValue = checked;
}
// Build next state early // Build next state early
const newSettingsData = { const newSettingsData = {
...settingsData, ...settingsData,
settings: { ...settingsData.settings, [name]: value }, settings: { ...settingsData.settings, [name]: newValue ?? value },
}; };
// Validate // Validate
+4
View File
@@ -294,6 +294,10 @@ const settingsValidation = joi.object({
systemEmailPassword: joi.string().allow(""), systemEmailPassword: joi.string().allow(""),
systemEmailUser: joi.string().allow(""), systemEmailUser: joi.string().allow(""),
systemEmailConnectionHost: joi.string().allow(""), systemEmailConnectionHost: joi.string().allow(""),
systemEmailTLSServername: joi.string().allow(""),
systemEmailIgnoreTLS: joi.boolean().optional(),
systemEmailRequireTLS: joi.boolean().optional(),
systemEmailRejectUnauthorized: joi.boolean().optional(),
}); });
const dayjsValidator = (value, helpers) => { const dayjsValidator = (value, helpers) => {
+8 -1
View File
@@ -105,6 +105,10 @@ class EmailService {
systemEmailAddress, systemEmailAddress,
systemEmailPassword, systemEmailPassword,
systemEmailConnectionHost, systemEmailConnectionHost,
systemEmailTLSServername,
systemEmailIgnoreTLS,
systemEmailRequireTLS,
systemEmailRejectUnauthorized,
} = config; } = config;
const baseEmailConfig = { const baseEmailConfig = {
@@ -126,7 +130,10 @@ class EmailService {
name: systemEmailConnectionHost || "localhost", name: systemEmailConnectionHost || "localhost",
secure: false, secure: false,
pool: true, pool: true,
tls: { rejectUnauthorized: false }, tls: { rejectUnauthorized: systemEmailRejectUnauthorized },
ignoreTLS: systemEmailIgnoreTLS,
requireTLS: systemEmailRequireTLS,
servername: systemEmailTLSServername,
} }
: baseEmailConfig; : baseEmailConfig;