Add option to ignore SSL/TLS certificate errors for email (Issue #53)
This feature allows users with non-standard SMTP setups (shared hosting, self-signed certificates) to bypass certificate validation when needed. Changes: - Add database migration for tls_reject_unauthorized column - Update emailProcessor.js to pass TLS option to nodemailer - Update adminEmail.js routes to handle the new field - Add checkbox UI with security warning in EmailConfigPage - Add English and German translations
This commit is contained in:
@@ -1327,7 +1327,34 @@
|
||||
"saveConfiguration": "Konfiguration speichern",
|
||||
"emailTemplates": "E-Mail-Vorlagen",
|
||||
"templateVariables": "Verfügbare Variablen",
|
||||
"previewTemplate": "Vorlage anzeigen"
|
||||
"previewTemplate": "Vorlage anzeigen",
|
||||
"smtpSettings": "SMTP-Einstellungen",
|
||||
"testEmailSuccess": "Test-E-Mail erfolgreich gesendet",
|
||||
"saveSmtpSettings": "SMTP-Einstellungen speichern",
|
||||
"testEmailSection": "E-Mail testen",
|
||||
"beforeTesting": "Vor dem Testen:",
|
||||
"saveSmtpFirst": "Speichern Sie zuerst Ihre SMTP-Einstellungen",
|
||||
"ensureFirewall": "Stellen Sie sicher, dass Ihre Firewall ausgehende SMTP-Verbindungen erlaubt",
|
||||
"gmailAppPassword": "Für Gmail verwenden Sie ein App-spezifisches Passwort",
|
||||
"testEmailAddressLabel": "Test-E-Mail-Adresse",
|
||||
"sendTestEmailButton": "Test-E-Mail senden",
|
||||
"commonSmtpSettings": "Häufige SMTP-Einstellungen:",
|
||||
"editTemplate": "Vorlage bearbeiten",
|
||||
"templateName": "Vorlagenname",
|
||||
"subjectLine": "Betreffzeile",
|
||||
"emailBody": "E-Mail-Text",
|
||||
"preview": "Vorschau",
|
||||
"saveChanges": "Änderungen speichern",
|
||||
"templates": "Vorlagen",
|
||||
"variableHelp": "Verwenden Sie diese Variablen in Ihrer Vorlage. Sie werden beim Senden durch tatsächliche Werte ersetzt.",
|
||||
"port": "Port",
|
||||
"security": "Sicherheit",
|
||||
"username": "Benutzername",
|
||||
"password": "Passwort",
|
||||
"enterPassword": "Passwort eingeben",
|
||||
"required": "erforderlich",
|
||||
"ignoreSslErrors": "SSL/TLS-Zertifikatfehler ignorieren",
|
||||
"ignoreSslWarning": "Warnung: Das Deaktivieren der Zertifikatüberprüfung macht die Verbindung anfällig für Man-in-the-Middle-Angriffe. Aktivieren Sie dies nur, wenn Sie dem SMTP-Server vertrauen und die Sicherheitsrisiken verstehen."
|
||||
},
|
||||
"cms": {
|
||||
"title": "CMS-Seiten",
|
||||
|
||||
@@ -1072,7 +1072,9 @@
|
||||
"enterPassword": "Enter password",
|
||||
"fromEmail": "From Email",
|
||||
"fromName": "From Name",
|
||||
"required": "required"
|
||||
"required": "required",
|
||||
"ignoreSslErrors": "Ignore SSL/TLS certificate errors",
|
||||
"ignoreSslWarning": "Warning: Disabling certificate verification makes the connection vulnerable to man-in-the-middle attacks. Only enable this if you trust the SMTP server and understand the security implications."
|
||||
},
|
||||
"cms": {
|
||||
"title": "CMS Pages",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Mail,
|
||||
Save,
|
||||
Send,
|
||||
import {
|
||||
Mail,
|
||||
Save,
|
||||
Send,
|
||||
Server,
|
||||
Lock,
|
||||
User,
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
CheckCircle,
|
||||
Eye,
|
||||
EyeOff,
|
||||
ShieldAlert,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
@@ -107,7 +108,8 @@ export const EmailConfigPage: React.FC = () => {
|
||||
smtp_user: '',
|
||||
smtp_pass: '',
|
||||
from_email: '',
|
||||
from_name: 'Photo Sharing'
|
||||
from_name: 'Photo Sharing',
|
||||
tls_reject_unauthorized: true
|
||||
});
|
||||
|
||||
// Fetch SMTP config
|
||||
@@ -342,7 +344,7 @@ export const EmailConfigPage: React.FC = () => {
|
||||
placeholder="587"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-neutral-700 mb-1">
|
||||
{t('email.security')}
|
||||
@@ -358,6 +360,30 @@ export const EmailConfigPage: React.FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Ignore SSL Certificate Errors */}
|
||||
<div className="mt-2">
|
||||
<label className="flex items-center gap-3 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={!smtpConfig.tls_reject_unauthorized}
|
||||
onChange={(e) => setSmtpConfig(prev => ({ ...prev, tls_reject_unauthorized: !e.target.checked }))}
|
||||
className="w-4 h-4 text-primary-600 border-neutral-300 rounded focus:ring-primary-500"
|
||||
/>
|
||||
<span className="text-sm font-medium text-neutral-700">
|
||||
{t('email.ignoreSslErrors')}
|
||||
</span>
|
||||
</label>
|
||||
{!smtpConfig.tls_reject_unauthorized && (
|
||||
<div className="mt-2 p-3 bg-amber-50 border border-amber-200 rounded-lg">
|
||||
<div className="flex items-start gap-2">
|
||||
<ShieldAlert className="w-4 h-4 text-amber-600 flex-shrink-0 mt-0.5" />
|
||||
<p className="text-xs text-amber-800">
|
||||
{t('email.ignoreSslWarning')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-neutral-700 mb-1">
|
||||
{t('email.username')}
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface EmailConfig {
|
||||
smtp_pass: string;
|
||||
from_email: string;
|
||||
from_name: string;
|
||||
tls_reject_unauthorized: boolean;
|
||||
}
|
||||
|
||||
export interface EmailTemplate {
|
||||
|
||||
Reference in New Issue
Block a user