diff --git a/application/component/oeusercomponent.php b/application/component/oeusercomponent.php new file mode 100644 index 0000000..bd005b0 --- /dev/null +++ b/application/component/oeusercomponent.php @@ -0,0 +1,39 @@ +captcha === null) { + $this->captcha = oxNew('oeCaptcha'); + } + return $this->captcha; + } + + public function createUser() + { + if (!$this->getCaptcha()->passCaptcha()) { + return false; + } + + return parent::createUser(); + } +} diff --git a/controllers/oecaptcharegister.php b/controllers/oecaptcharegister.php new file mode 100644 index 0000000..7005fe4 --- /dev/null +++ b/controllers/oecaptcharegister.php @@ -0,0 +1,52 @@ +editval, error + * + * @return null + */ + public function send() + { + // spam spider prevension + if (!$this->getCaptcha()->passCaptcha()) { + return false; + } + + return parent::send(); + } + + /** + * Template variable getter. Returns object of handling CAPTCHA image + * + * @return object + */ + public function getCaptcha() + { + if ($this->captcha === null) { + $this->captcha = oxNew('oeCaptcha'); + } + + return $this->captcha; + } +} diff --git a/metadata.php b/metadata.php index b8e7bd9..b37181b 100755 --- a/metadata.php +++ b/metadata.php @@ -44,7 +44,10 @@ $aModule = array( 'newsletter' => 'oe/captcha/controllers/oecaptchanewsletter', 'pricealarm' => 'oe/captcha/controllers/oecaptchapricealarm', 'suggest' => 'oe/captcha/controllers/oecaptchasuggest', - 'oxwarticledetails' => 'oe/captcha/application/component/widget/oecaptchawarticledetails'), + 'oxwarticledetails' => 'oe/captcha/application/component/widget/oecaptchawarticledetails', + \OxidEsales\Eshop\Application\Component\UserComponent::class => 'oe/captcha/application/component/oeusercomponent', + 'register' => 'oe/captcha/controllers/oecaptcharegister' + ), 'files' => array( 'oecaptcha' => 'oe/captcha/core/oecaptcha.php', 'oecaptchaEvents' => 'oe/captcha/core/oecaptchaevents.php', @@ -59,6 +62,8 @@ $aModule = array( array('template' => 'form/pricealarm.tpl', 'block'=>'captcha_form', 'file'=>'/application/views/blocks/captcha_form.tpl'), array('template' => 'form/suggest.tpl', 'block'=>'captcha_form', 'file'=>'/application/views/blocks/captcha_form.tpl'), array('template' => 'form/forgotpwd_email.tpl', 'block'=>'captcha_form', 'file'=>'/application/views/blocks/captcha_form_forgotpwd.tpl'), + array('template' => 'form/fieldset/user_billing.tpl', 'block'=>'captcha_form', 'file'=>'/application/views/blocks/captcha_form.tpl' + ), ), 'settings' => array( array('group' => 'main', 'name' => 'oecaptchakey', 'type' => 'str', 'value' => ''),