improve extendability

This commit is contained in:
Daniel Seifert 2024-08-01 10:43:28 +02:00
parent f7f9c28b53
commit ba97743b3e

View File

@ -44,7 +44,18 @@ class SmtpChecker extends AdminDetailsController
{ {
parent::__construct(); parent::__construct();
/** @var Shop $activeShop */ $this->setSmtpCredentials();
$this->from = Registry::getRequest()->getRequestEscapedParameter('from') ?: '';
$this->addTplParam('from', $this->from);
$this->to = Registry::getRequest()->getRequestEscapedParameter('to') ?: '';
$this->addTplParam('recipient', $this->to);
$this->addTplParam('sendMail', Registry::getRequest()->getRequestEscapedParameter('sendmail'));
$this->addTplParam('smtpLog', $this->log);
}
protected function setSmtpCredentials(): void
{
$activeShop = Registry::getConfig()->getActiveShop(); $activeShop = Registry::getConfig()->getActiveShop();
if ($localHost = Registry::getRequest()->getRequestEscapedParameter('smtpHost')) { if ($localHost = Registry::getRequest()->getRequestEscapedParameter('smtpHost')) {
@ -60,13 +71,6 @@ class SmtpChecker extends AdminDetailsController
$this->addTplParam('smtpUser', $this->user); $this->addTplParam('smtpUser', $this->user);
$this->pwd = Registry::getRequest()->getRequestEscapedParameter('smtpPwd') ?: $activeShop->getFieldData('oxsmtppwd'); $this->pwd = Registry::getRequest()->getRequestEscapedParameter('smtpPwd') ?: $activeShop->getFieldData('oxsmtppwd');
$this->addTplParam('smtpPwd', $this->pwd); $this->addTplParam('smtpPwd', $this->pwd);
$this->from = Registry::getRequest()->getRequestEscapedParameter('from') ?: '';
$this->addTplParam('from', $this->from);
$this->to = Registry::getRequest()->getRequestEscapedParameter('to') ?: '';
$this->addTplParam('recipient', $this->to);
$this->addTplParam('sendMail', Registry::getRequest()->getRequestEscapedParameter('sendmail'));
$this->addTplParam('smtpLog', $this->log);
} }
public function getTemplateName(): string public function getTemplateName(): string