This commit is contained in:
@@ -60,7 +60,6 @@ let adminTablesSelectedSelect;
|
||||
let adminTablesAddBtn;
|
||||
let adminTablesRemoveBtn;
|
||||
let adminLoadBridgeBtn;
|
||||
let smtpTestBtn;
|
||||
|
||||
ensureConsoleCapture();
|
||||
|
||||
@@ -93,7 +92,6 @@ export function initAccountPage() {
|
||||
adminTablesAddBtn = document.getElementById('adminBridgeTablesAdd');
|
||||
adminTablesRemoveBtn = document.getElementById('adminBridgeTablesRemove');
|
||||
adminLoadBridgeBtn = document.getElementById('btn-admin-load-bridge');
|
||||
smtpTestBtn = document.getElementById('btn-smtp-test');
|
||||
sectionsList = document.getElementById('sectionsList');
|
||||
sectionsCreateForm = document.getElementById('sectionsCreateForm');
|
||||
sectionNameInput = document.getElementById('sectionNameInput');
|
||||
@@ -153,9 +151,6 @@ export function initAccountPage() {
|
||||
adminLoadBridgeBtn?.addEventListener('click', () => {
|
||||
refreshBridgeTablesFromEndpoint();
|
||||
});
|
||||
smtpTestBtn?.addEventListener('click', () => {
|
||||
runSmtpTest();
|
||||
});
|
||||
|
||||
initSectionsManager();
|
||||
|
||||
@@ -473,19 +468,6 @@ function fillSettingsForm(settings) {
|
||||
: 0;
|
||||
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 || []);
|
||||
}
|
||||
|
||||
@@ -539,19 +521,6 @@ async function submitSettingsForm(ev) {
|
||||
const parsed = raw === '' ? 0 : Number(raw);
|
||||
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) {
|
||||
const bridgeTables = normalizeTableList(state.settings.bridge_tables || []);
|
||||
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) {
|
||||
const items = Array.isArray(input) ? input : (typeof input === 'string' ? input.split(/[\s,]+/) : []);
|
||||
|
||||
Reference in New Issue
Block a user