diff --git a/core/oecaptcha.php b/core/oecaptcha.php index 88ef8b8..d086d25 100644 --- a/core/oecaptcha.php +++ b/core/oecaptcha.php @@ -110,10 +110,14 @@ class oeCaptcha extends oxSuperCfg */ public function getImageUrl() { - $url = $this->getConfig()->getCurrentShopUrl() . 'modules/oe/captcha/core/utils/verificationimg.php?e_mac='; - $key = $this->getConfig()->getConfigParam('oecaptchakey'); - $key = empty($key) ? null : $key; - $url .= oxRegistry::getUtils()->strMan($this->getText(), $key); + $config = \OxidEsales\Eshop\Core\Registry::getConfig(); + $url = $config->getCurrentShopUrl() . 'modules/oe/captcha/core/utils/verificationimg.php?e_mac='; + $key = $config->getConfigParam('oecaptchakey'); + + $key = $key ? $key : $config->getConfigParam('sConfigKey'); + + $encryptor = new \OxidEsales\Eshop\Core\Encryptor(); + $url .= $encryptor->encrypt($this->getText(), $key); return $url; } diff --git a/tests/unit/core/oecaptchaTest.php b/tests/unit/core/oecaptchaTest.php index fb7bd44..12f2b30 100644 --- a/tests/unit/core/oecaptchaTest.php +++ b/tests/unit/core/oecaptchaTest.php @@ -78,7 +78,7 @@ class Unit_Core_oecaptchaTest extends CaptchaTestCase */ public function testGetImageUrl() { - $this->setConfigParam('oecaptchakey', 'someTestCaptchaKey'); + $this->getConfig()->setConfigParam("oecaptchakey", 'someTestCaptchaKey'); $this->captcha->setNonPublicVar('text', 'test1'); $expected = $this->getConfig()->getShopUrl() . 'modules/oe/captcha/core/utils/verificationimg.php?e_mac=ox_MAsbCBYgVBoQ'; @@ -90,7 +90,7 @@ class Unit_Core_oecaptchaTest extends CaptchaTestCase */ public function testGetImageUrlFallbackKey() { - $this->setConfigParam('oecaptchakey', ''); + $this->getConfig()->setConfigParam("oecaptchakey", ''); $this->captcha->setNonPublicVar('text', 'test1'); $expected = $this->getConfig()->getShopUrl() . 'modules/oe/captcha/core/utils/verificationimg.php?e_mac=ox_MB4FUUYlYlld';