add check for register

This commit is contained in:
Markus Gärtner 2022-02-23 09:20:32 +01:00 committed by MaxBUhe
parent b8f1c7e8aa
commit 0c74177b15
3 changed files with 97 additions and 1 deletions

View File

@ -0,0 +1,39 @@
<?php
/**
* #PHPHEADER_OECAPTCHA_LICENSE_INFORMATION#
*/
/**
* Article detailed information widget.
*/
class oeUserComponent extends oeUserComponent_parent
{
/**
* Class handling CAPTCHA image.
*
* @var object
*/
protected $captcha = null;
/**
* 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;
}
public function createUser()
{
if (!$this->getCaptcha()->passCaptcha()) {
return false;
}
return parent::createUser();
}
}

View File

@ -0,0 +1,52 @@
<?php
/**
* #PHPHEADER_OECAPTCHA_LICENSE_INFORMATION#
*/
/**
* Article suggestion page.
* Collects some article base information, sets default recomendation text,
* sends suggestion mail to user.
*/
class oeCaptchaRegister extends oeCaptchaRegister_parent
{
/**
* Class handling CAPTCHA image.
*
* @var object
*/
protected $captcha = null;
/**
* Sends product suggestion mail and returns a URL according to
* URL formatting rules.
*
* Template variables:
* <b>editval</b>, <b>error</b>
*
* @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;
}
}

View File

@ -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' => ''),