This commit is contained in:
2026-02-24 01:19:11 +01:00
parent da44c2c9a5
commit 66d29ff6c4
2 changed files with 0 additions and 98 deletions

View File

@@ -127,49 +127,6 @@ require dirname(__DIR__) . '/../structure/layout_start.php';
<button type="button" class="btn" data-rotate="external">Neu erstellen</button> <button type="button" class="btn" data-rotate="external">Neu erstellen</button>
</div> </div>
</div> </div>
<fieldset class="border border-slate-200 rounded-xl p-4">
<legend class="px-2 text-sm font-semibold">SMTP-Versand</legend>
<p class="text-xs text-slate-500 mb-3">Diese Zugangsdaten werden fuer den Testversand genutzt, wenn SMTP aktiviert ist.</p>
<div class="flex items-center justify-between gap-3 mb-3">
<label class="inline-flex items-center gap-2 text-sm text-slate-600">
<input type="checkbox" name="smtp_enabled" value="1"> SMTP aktivieren
</label>
<button type="button" id="btn-smtp-test" class="btn">SMTP Test</button>
</div>
<div class="grid md:grid-cols-2 gap-3">
<label class="block text-sm text-slate-600">SMTP-Server
<input type="text" name="smtp_host" class="input mt-1" placeholder="smtp.example.com">
</label>
<label class="block text-sm text-slate-600">Port
<input type="number" name="smtp_port" class="input mt-1" placeholder="587">
</label>
<label class="block text-sm text-slate-600">Verschluesselung
<select name="smtp_secure" class="input mt-1">
<option value="">Keine</option>
<option value="tls">TLS</option>
<option value="ssl">SSL</option>
</select>
</label>
<label class="block text-sm text-slate-600">Benutzername
<input type="text" name="smtp_user" class="input mt-1" placeholder="user@example.com">
</label>
<label class="block text-sm text-slate-600">Passwort
<input type="password" name="smtp_pass" class="input mt-1" placeholder="••••••••">
</label>
<label class="inline-flex items-center gap-2 text-xs text-slate-500 mt-6">
<input type="checkbox" name="smtp_pass_clear" value="1"> Passwort loeschen
</label>
<label class="block text-sm text-slate-600">SMTP-Absender (E-Mail)
<input type="email" name="smtp_from_email" class="input mt-1" placeholder="no-reply@example.com">
</label>
<label class="block text-sm text-slate-600">SMTP-Absender (Name)
<input type="text" name="smtp_from_name" class="input mt-1" placeholder="EmailTemplate">
</label>
<label class="block text-sm text-slate-600">Reply-To (optional)
<input type="email" name="smtp_reply_to" class="input mt-1" placeholder="support@example.com">
</label>
</div>
</fieldset>
<div class="flex justify-between gap-2 flex-wrap pt-2"> <div class="flex justify-between gap-2 flex-wrap pt-2">
<div class="flex gap-2" data-role="admin"> <div class="flex gap-2" data-role="admin">
<button type="button" class="btn" data-download="bridge">Bridge-Datei</button> <button type="button" class="btn" data-download="bridge">Bridge-Datei</button>

View File

@@ -60,7 +60,6 @@ let adminTablesSelectedSelect;
let adminTablesAddBtn; let adminTablesAddBtn;
let adminTablesRemoveBtn; let adminTablesRemoveBtn;
let adminLoadBridgeBtn; let adminLoadBridgeBtn;
let smtpTestBtn;
ensureConsoleCapture(); ensureConsoleCapture();
@@ -93,7 +92,6 @@ export function initAccountPage() {
adminTablesAddBtn = document.getElementById('adminBridgeTablesAdd'); adminTablesAddBtn = document.getElementById('adminBridgeTablesAdd');
adminTablesRemoveBtn = document.getElementById('adminBridgeTablesRemove'); adminTablesRemoveBtn = document.getElementById('adminBridgeTablesRemove');
adminLoadBridgeBtn = document.getElementById('btn-admin-load-bridge'); adminLoadBridgeBtn = document.getElementById('btn-admin-load-bridge');
smtpTestBtn = document.getElementById('btn-smtp-test');
sectionsList = document.getElementById('sectionsList'); sectionsList = document.getElementById('sectionsList');
sectionsCreateForm = document.getElementById('sectionsCreateForm'); sectionsCreateForm = document.getElementById('sectionsCreateForm');
sectionNameInput = document.getElementById('sectionNameInput'); sectionNameInput = document.getElementById('sectionNameInput');
@@ -153,9 +151,6 @@ export function initAccountPage() {
adminLoadBridgeBtn?.addEventListener('click', () => { adminLoadBridgeBtn?.addEventListener('click', () => {
refreshBridgeTablesFromEndpoint(); refreshBridgeTablesFromEndpoint();
}); });
smtpTestBtn?.addEventListener('click', () => {
runSmtpTest();
});
initSectionsManager(); initSectionsManager();
@@ -473,19 +468,6 @@ function fillSettingsForm(settings) {
: 0; : 0;
settingsForm.versions_retention.value = String(Math.max(0, retention)); settingsForm.versions_retention.value = String(Math.max(0, retention));
} }
if (settingsForm.smtp_enabled) settingsForm.smtp_enabled.checked = Number(settings.smtp_enabled) === 1;
if (settingsForm.smtp_host) settingsForm.smtp_host.value = settings.smtp_host || '';
if (settingsForm.smtp_port) settingsForm.smtp_port.value = settings.smtp_port ? String(settings.smtp_port) : '';
if (settingsForm.smtp_user) settingsForm.smtp_user.value = settings.smtp_user || '';
if (settingsForm.smtp_pass) settingsForm.smtp_pass.value = '';
if (settingsForm.smtp_pass) {
settingsForm.smtp_pass.placeholder = settings.smtp_pass_set ? 'Passwort gesetzt' : '••••••••';
}
if (settingsForm.smtp_pass_clear) settingsForm.smtp_pass_clear.checked = false;
if (settingsForm.smtp_secure) settingsForm.smtp_secure.value = settings.smtp_secure || '';
if (settingsForm.smtp_from_email) settingsForm.smtp_from_email.value = settings.smtp_from_email || '';
if (settingsForm.smtp_from_name) settingsForm.smtp_from_name.value = settings.smtp_from_name || '';
if (settingsForm.smtp_reply_to) settingsForm.smtp_reply_to.value = settings.smtp_reply_to || '';
refreshAdminTables(settings.bridge_setup?.tables || [], settings.bridge_tables || []); refreshAdminTables(settings.bridge_setup?.tables || [], settings.bridge_tables || []);
} }
@@ -539,19 +521,6 @@ async function submitSettingsForm(ev) {
const parsed = raw === '' ? 0 : Number(raw); const parsed = raw === '' ? 0 : Number(raw);
data.versions_retention = Number.isFinite(parsed) ? Math.max(0, Math.floor(parsed)) : 0; data.versions_retention = Number.isFinite(parsed) ? Math.max(0, Math.floor(parsed)) : 0;
} }
if (settingsForm.smtp_enabled) data.smtp_enabled = settingsForm.smtp_enabled.checked ? 1 : 0;
if (settingsForm.smtp_host) data.smtp_host = settingsForm.smtp_host.value.trim();
if (settingsForm.smtp_port) {
const rawPort = settingsForm.smtp_port.value.trim();
data.smtp_port = rawPort === '' ? 0 : Number(rawPort);
}
if (settingsForm.smtp_user) data.smtp_user = settingsForm.smtp_user.value.trim();
if (settingsForm.smtp_pass) data.smtp_pass = settingsForm.smtp_pass.value;
if (settingsForm.smtp_pass_clear) data.smtp_pass_clear = settingsForm.smtp_pass_clear.checked ? 1 : 0;
if (settingsForm.smtp_secure) data.smtp_secure = settingsForm.smtp_secure.value;
if (settingsForm.smtp_from_email) data.smtp_from_email = settingsForm.smtp_from_email.value.trim();
if (settingsForm.smtp_from_name) data.smtp_from_name = settingsForm.smtp_from_name.value.trim();
if (settingsForm.smtp_reply_to) data.smtp_reply_to = settingsForm.smtp_reply_to.value.trim();
if (adminTablesAllSelect && adminTablesSelectedSelect) { if (adminTablesAllSelect && adminTablesSelectedSelect) {
const bridgeTables = normalizeTableList(state.settings.bridge_tables || []); const bridgeTables = normalizeTableList(state.settings.bridge_tables || []);
data.bridge_tables = bridgeTables; data.bridge_tables = bridgeTables;
@@ -588,30 +557,6 @@ async function downloadFile(type) {
} }
} }
async function runSmtpTest() {
if (!settingsForm) return;
const recipient = prompt('Test-E-Mail an welche Adresse senden?', window.__currentUser?.email || '');
if (!recipient) return;
const data = {
to: recipient.trim(),
smtp_enabled: settingsForm.smtp_enabled?.checked ? 1 : 0,
smtp_host: settingsForm.smtp_host?.value.trim() || '',
smtp_port: settingsForm.smtp_port?.value.trim() || '',
smtp_user: settingsForm.smtp_user?.value.trim() || '',
smtp_pass: settingsForm.smtp_pass?.value || '',
smtp_secure: settingsForm.smtp_secure?.value || '',
smtp_from_email: settingsForm.smtp_from_email?.value.trim() || '',
smtp_from_name: settingsForm.smtp_from_name?.value.trim() || '',
smtp_reply_to: settingsForm.smtp_reply_to?.value.trim() || '',
};
try {
const res = await apiAction('account.smtp.test', { method: 'POST', data });
if (!res?.ok) throw new Error(res?.error || 'SMTP Test fehlgeschlagen');
toast('SMTP Test gesendet', true);
} catch (err) {
toast(err.message || 'SMTP Test fehlgeschlagen', false);
}
}
function normalizeTableList(input) { function normalizeTableList(input) {
const items = Array.isArray(input) ? input : (typeof input === 'string' ? input.split(/[\s,]+/) : []); const items = Array.isArray(input) ? input : (typeof input === 'string' ? input.split(/[\s,]+/) : []);