From 9ce7ffe4bd5f2f0e0dbed060cc08a1fee5de6b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1zhan=20Burak=20Yakar?= Date: Tue, 20 Jan 2026 01:27:57 +0300 Subject: [PATCH] Fixed emails (#3189) * Fix email settings form not toggling between input boxes * Fix deprecated call to $di['config'] --- src/modules/Email/Service.php | 4 +- .../html_admin/mod_email_settings.html.twig | 50 +++++++++---------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/modules/Email/Service.php b/src/modules/Email/Service.php index 47437fcfe..ef07f2baf 100644 --- a/src/modules/Email/Service.php +++ b/src/modules/Email/Service.php @@ -125,7 +125,7 @@ class Service implements \FOSSBilling\InjectionAwareInterface public function setVars($t, $vars): bool { - $t->vars = $this->di['crypt']->encrypt(json_encode($vars), $this->di['config']['salt']); + $t->vars = $this->di['crypt']->encrypt(json_encode($vars), Config::getProperty('info.salt')); $this->di['db']->store($t); return true; @@ -136,7 +136,7 @@ class Service implements \FOSSBilling\InjectionAwareInterface */ public function getVars($t): array { - $json = $this->di['crypt']->decrypt($t->vars, $this->di['config']['salt']); + $json = $this->di['crypt']->decrypt($t->vars, Config::getProperty('info.salt')); return is_string($json) ? json_decode($json, true) : []; } diff --git a/src/modules/Email/html_admin/mod_email_settings.html.twig b/src/modules/Email/html_admin/mod_email_settings.html.twig index cb3663018..d9765f854 100644 --- a/src/modules/Email/html_admin/mod_email_settings.html.twig +++ b/src/modules/Email/html_admin/mod_email_settings.html.twig @@ -406,36 +406,34 @@ event.preventDefault(); }); - document.addEventListener('DOMContentLoaded', function() { - const mailerInputs = document.querySelectorAll('#mailer input'); + const mailerInputs = document.querySelectorAll('#mailer input'); - mailerInputs.forEach(input => { - input.addEventListener('click', function() { - const smtpFieldset = document.querySelector('fieldset.smtp'); - const sendgridFieldset = document.querySelector('fieldset.sendgrid'); - const customFieldset = document.querySelector('fieldset.custom'); + mailerInputs.forEach(input => { + input.addEventListener('click', function() { + const smtpFieldset = document.querySelector('fieldset.smtp'); + const sendgridFieldset = document.querySelector('fieldset.sendgrid'); + const customFieldset = document.querySelector('fieldset.custom'); - // Handle SMTP fieldset. - if (this.value === 'smtp') { - smtpFieldset.style.display = 'block'; - } else { - smtpFieldset.style.display = 'none'; - } + // Handle SMTP fieldset. + if (this.value === 'smtp') { + smtpFieldset.style.display = 'block'; + } else { + smtpFieldset.style.display = 'none'; + } - // Handle SendGrid fieldset. - if (this.value === 'sendgrid') { - sendgridFieldset.style.display = 'block'; - } else { - sendgridFieldset.style.display = 'none'; - } + // Handle SendGrid fieldset. + if (this.value === 'sendgrid') { + sendgridFieldset.style.display = 'block'; + } else { + sendgridFieldset.style.display = 'none'; + } - // Handle Custom fieldset. - if (this.value === 'custom') { - customFieldset.style.display = 'block'; - } else { - customFieldset.style.display = 'none'; - } - }); + // Handle Custom fieldset. + if (this.value === 'custom') { + customFieldset.style.display = 'block'; + } else { + customFieldset.style.display = 'none'; + } }); }); });