Captcha for newsletter subscription added

This form is often used for spam attacks.
Requires new template blocks in the frontend theme.
This commit is contained in:
Daniel Seifert 2020-11-14 12:44:46 +01:00
parent 88c9ffa235
commit 89d543156f
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,44 @@
<?php
/**
* #PHPHEADER_OECAPTCHA_LICENSE_INFORMATION#
*/
class oeCaptchaNewsletter extends oeCaptchaNewsletter_parent
{
/**
* Class handling CAPTCHA image.
*
* @var object
*/
protected $captcha = null;
/**
* Composes and sends user written message, returns false if some parameters
* are missing.
*
* @return bool
*/
public function send()
{
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

@ -40,6 +40,7 @@ $aModule = array(
'extend' => array('details' => 'oe/captcha/controllers/oecaptchadetails',
'contact' => 'oe/captcha/controllers/oecaptchacontact',
'invite' => 'oe/captcha/controllers/oecaptchainvite',
'newsletter' => 'oe/captcha/controllers/oecaptchanewsletter',
'pricealarm' => 'oe/captcha/controllers/oecaptchapricealarm',
'suggest' => 'oe/captcha/controllers/oecaptchasuggest',
'oxwarticledetails' => 'oe/captcha/application/component/widget/oecaptchawarticledetails'),
@ -52,6 +53,7 @@ $aModule = array(
),
'blocks' => array(
array('template' => 'form/contact.tpl', 'block'=>'captcha_form', 'file'=>'/application/views/blocks/captcha_form.tpl'),
array('template' => 'form/newsletter.tpl', 'block'=>'captcha_form', 'file'=>'/application/views/blocks/captcha_form.tpl'),
array('template' => 'form/privatesales/invite.tpl', 'block'=>'captcha_form', 'file'=>'/application/views/blocks/captcha_form.tpl'),
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'),