Merge pull request #6 from SeifertDaniel/feature/newslettercaptcha

Captcha for newsletter subscription added
This commit is contained in:
Marco Steinhaeuser 2020-12-10 09:22:50 +01:00 committed by GitHub
commit f8bdc5285c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 98 additions and 3 deletions

View File

@ -1,3 +1,3 @@
[{$smarty.block.parent}] [{$smarty.block.parent}]
[{include file="oecaptcha.tpl"}] [{include file="oecaptcha.tpl" labelCssClass="col-lg-2" inputCssClass="col-lg-10"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="oecaptcha.tpl" labelCssClass="col-md-3" inputCssClass="col-md-9"}]

View File

@ -2,9 +2,9 @@
<input type="hidden" name="c_mach" value="[{$oCaptcha->getHash()}]"/> <input type="hidden" name="c_mach" value="[{$oCaptcha->getHash()}]"/>
<div class="form-group verify"> <div class="form-group verify">
<label class="req control-label col-lg-2" for="c_mac">[{oxmultilang ident="VERIFICATION_CODE"}]</label> <label class="req control-label [{$labelCssClass}]" for="c_mac">[{oxmultilang ident="VERIFICATION_CODE"}]</label>
<div class="col-lg-10 controls"> <div class="[{$inputCssClass}] controls">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"> <span class="input-group-addon">
[{if $oCaptcha->isImageVisible()}] [{if $oCaptcha->isImageVisible()}]

View File

@ -0,0 +1,44 @@
<?php
/**
* #PHPHEADER_OECAPTCHA_LICENSE_INFORMATION#
*/
class oeCaptchaForgotPwd extends oeCaptchaForgotPwd_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 forgotpassword()
{
if (!$this->getCaptcha()->passCaptcha()) {
return false;
}
return parent::forgotpassword();
}
/**
* 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

@ -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

@ -39,7 +39,9 @@ $aModule = array(
'email' => '', 'email' => '',
'extend' => array('details' => 'oe/captcha/controllers/oecaptchadetails', 'extend' => array('details' => 'oe/captcha/controllers/oecaptchadetails',
'contact' => 'oe/captcha/controllers/oecaptchacontact', 'contact' => 'oe/captcha/controllers/oecaptchacontact',
'forgotpwd' => 'oe/captcha/controllers/oecaptchaforgotpwd',
'invite' => 'oe/captcha/controllers/oecaptchainvite', 'invite' => 'oe/captcha/controllers/oecaptchainvite',
'newsletter' => 'oe/captcha/controllers/oecaptchanewsletter',
'pricealarm' => 'oe/captcha/controllers/oecaptchapricealarm', 'pricealarm' => 'oe/captcha/controllers/oecaptchapricealarm',
'suggest' => 'oe/captcha/controllers/oecaptchasuggest', 'suggest' => 'oe/captcha/controllers/oecaptchasuggest',
'oxwarticledetails' => 'oe/captcha/application/component/widget/oecaptchawarticledetails'), 'oxwarticledetails' => 'oe/captcha/application/component/widget/oecaptchawarticledetails'),
@ -52,9 +54,11 @@ $aModule = array(
), ),
'blocks' => array( 'blocks' => array(
array('template' => 'form/contact.tpl', 'block'=>'captcha_form', 'file'=>'/application/views/blocks/captcha_form.tpl'), 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/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/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/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'),
), ),
'settings' => array( 'settings' => array(
array('group' => 'main', 'name' => 'oecaptchakey', 'type' => 'str', 'value' => ''), array('group' => 'main', 'name' => 'oecaptchakey', 'type' => 'str', 'value' => ''),