make SMTP credentials extendable

This commit is contained in:
Daniel Seifert 2024-08-22 09:56:01 +02:00
parent 0ac5d75b9a
commit e06cc155dc
2 changed files with 18 additions and 3 deletions

View File

@ -26,7 +26,22 @@ use OxidEsales\Eshop\Core\Registry;
class MailConfigCheck extends AdminDetailsController
{
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/mailConfigCheck';
protected string $testMailAddress = 'test@example.dev';
protected string $testMailAddress = 'test@example.tld';
public function __construct()
{
parent::__construct();
$this->setSmtpCredentials();
}
protected function setSmtpCredentials(): void
{
$shop = Registry::getConfig()->getActiveShop();
$this->addTplParam('smtpHost', $shop->getFieldData('oxsmtp'));
$this->addTplParam('smtpUser', $shop->getFieldData('oxsmtpuser'));
}
public function render(): string
{

View File

@ -64,9 +64,9 @@ class SmtpChecker extends AdminDetailsController
['host' => $shopHost, 'port' => $shopPort] = parse_url(trim($activeShop->getFieldData('oxsmtp')));
}
$this->host = $shopHost;
$this->host = $shopHost ?? '';
$this->addTplParam('smtpHost', Registry::getRequest()->getRequestEscapedParameter('smtpHost'));
$this->port = $shopPort;
$this->port = $shopPort ?? 587;
$this->user = Registry::getRequest()->getRequestEscapedParameter('smtpUser') ?: $activeShop->getFieldData('oxsmtpuser');
$this->addTplParam('smtpUser', $this->user);
$this->pwd = Registry::getRequest()->getRequestEscapedParameter('smtpPwd') ?: $activeShop->getFieldData('oxsmtppwd');