Compare commits

...

11 Commits

12 changed files with 304 additions and 9 deletions

View File

@ -19,7 +19,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Security
## 2.0.8 - 08 September 2023
- add check for Amazon Pay - no Captcha
## 2.0.7 - 08 September 2023
- add check for PayPal Checkout - no Captcha
## 2.0.6 - 18 Juli 2023
- don't request captcha if user is logged in
## [2.0.4] - 22 Oct 2021

View File

@ -0,0 +1,58 @@
<?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()
{
/* START check for Amazon Pay - no Captcha */
ob_start();
debug_print_backtrace();
$trace = ob_get_contents();
ob_end_clean();
if(str_contains($trace, 'initAmazonPayExpress'))
{
return parent::createUser();
}
/* END check for Amazon Pay - no Captcha /
/* START check for PayPal Checkout - no Captcha */
if(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('fnc') == 'approveOrder')
{
return parent::createUser();
}
/* START check for PayPal Checkout - no Captcha */
if (!$this->getCaptcha()->passCaptcha()) {
return false;
}
return parent::createUser();
}
}

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="oecaptcha_wave.tpl" labelCssClass="control-label col-lg-2" inputCssClass="col-lg-5"}]

View File

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

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="oecaptcha_wave.tpl" labelCssClass="control-label col-lg-2" inputCssClass="col-lg-5"}]

View File

@ -0,0 +1,5 @@
[{$smarty.block.parent}]
[{if !$oxcmp_user}]
[{include file="oecaptcha_wave.tpl" labelCssClass="col-lg-3" inputCssClass="col-lg-5"}]
[{/if}]

View File

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

View File

@ -0,0 +1,19 @@
[{assign var="oCaptcha" value=$oView->getCaptcha()}]
<input type="hidden" name="c_mach" value="[{$oCaptcha->getHash()}]"/>
<div class="form-group row verify">
<label class="req [{$labelCssClass}]" for="c_mac">[{oxmultilang ident="VERIFICATION_CODE"}]</label>
<div class="[{$inputCssClass}]">
<div class="input-group">
<span class="input-group-addon" style="padding-right:15px">
[{if $oCaptcha->isImageVisible()}]
<img src="[{$oCaptcha->getImageUrl()}]" alt="">
[{else}]
<span class="verificationCode" id="verifyTextCode">[{$oCaptcha->getText()}]</span>
[{/if}]
</span>
<input type="text" data-fieldsize="verify" name="c_mac" value="" class="form-control js-oxValidate js-oxValidate_notEmpty" required>
</div>
</div>
</div>

View File

@ -0,0 +1,29 @@
<?php
/**
* #PHPHEADER_OECAPTCHA_LICENSE_INFORMATION#
*/
class oecaptchaaccountuser extends oecaptchaaccountuser_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;
}
}

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

@ -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 oeCaptchaUser extends oeCaptchaUser_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

@ -17,6 +17,10 @@
/**
* Metadata version
*/
use OxidEsales\Eshop\Application\Component\UserComponent;
use OxidEsales\Eshop\Application\Controller\AccountUserController;
$sMetadataVersion = '1.1';
/**
@ -33,9 +37,9 @@ $aModule = array(
'en' => 'OXID eSales Simple Captcha Module',
),
'thumbnail' => 'out/pictures/picture.png',
'version' => '2.0.4',
'version' => '2.0.8',
'author' => 'OXID eSales AG',
'url' => 'http://www.oxid-esales.com/',
'url' => 'https://www.oxid-esales.com/',
'email' => '',
'extend' => array('details' => 'oe/captcha/controllers/oecaptchadetails',
'contact' => 'oe/captcha/controllers/oecaptchacontact',
@ -44,21 +48,78 @@ $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',
UserComponent::class => 'oe/captcha/application/component/oeusercomponent',
'register' => 'oe/captcha/controllers/oecaptcharegister',
'user' => 'oe/captcha/controllers/oecaptchauser',
AccountUserController::class => 'oe/captcha/controllers/oecaptchaaccountuser'
),
'files' => array(
'oecaptcha' => 'oe/captcha/core/oecaptcha.php',
'oecaptchaEvents' => 'oe/captcha/core/oecaptchaevents.php',
),
'templates' => array(
'oecaptcha.tpl' => 'oe/captcha/application/views/tpl/oecaptcha.tpl',
'oecaptcha_wave.tpl' => 'oe/captcha/application/views/tpl/oecaptcha_wave.tpl',
),
'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'),
array('template' => 'form/forgotpwd_email.tpl', 'block'=>'captcha_form', 'file'=>'/application/views/blocks/captcha_form_forgotpwd.tpl'),
array('template' => 'form/contact.tpl',
'block'=>'captcha_form',
'theme' => 'flow',
'file'=>'/application/views/blocks/captcha_form.tpl'),
array('template' => 'form/newsletter.tpl',
'block'=>'captcha_form',
'theme' => 'flow',
'file'=>'/application/views/blocks/captcha_form.tpl'),
array('template' => 'form/privatesales/invite.tpl',
'theme' => 'flow',
'block'=>'captcha_form',
'file'=>'/application/views/blocks/captcha_form.tpl'),
array('template' => 'form/pricealarm.tpl',
'block'=>'captcha_form',
'theme' => 'flow',
'file'=>'/application/views/blocks/captcha_form.tpl'),
array('template' => 'form/suggest.tpl',
'block'=>'captcha_form',
'theme' => 'flow',
'file'=>'/application/views/blocks/captcha_form.tpl'),
array('template' => 'form/forgotpwd_email.tpl',
'block'=>'captcha_form',
'theme' => 'flow',
'file'=>'/application/views/blocks/captcha_form_forgotpwd.tpl'),
array('template' => 'form/fieldset/user_billing.tpl',
'block'=>'captcha_form',
'theme' => 'flow',
'file'=>'/application/views/blocks/captcha_form.tpl'),
array('template' => 'form/contact.tpl',
'block'=>'captcha_form',
'theme' => 'wave',
'file'=>'/application/views/blocks/captcha_form_contact_wave.tpl'),
array('template' => 'form/newsletter.tpl',
'block'=>'captcha_form',
'theme' => 'wave',
'file'=>'/application/views/blocks/captcha_form_newsletter_wave.tpl'),
array('template' => 'form/privatesales/invite.tpl',
'theme' => 'wave',
'block'=>'captcha_form',
'file'=>'/application/views/blocks/captcha_form_wave.tpl'),
array('template' => 'form/pricealarm.tpl',
'block'=>'captcha_form',
'theme' => 'wave',
'file'=>'/application/views/blocks/captcha_form_wave.tpl'),
array('template' => 'form/suggest.tpl',
'block'=>'captcha_form',
'theme' => 'wave',
'file'=>'/application/views/blocks/captcha_form_wave.tpl'),
array('template' => 'form/forgotpwd_email.tpl',
'block'=>'captcha_form',
'theme' => 'wave',
'file'=>'/application/views/blocks/captcha_form_forgotpwd_wave.tpl'),
array('template' => 'form/fieldset/user_billing.tpl',
'block'=>'captcha_form',
'theme' => 'wave',
'file'=>'/application/views/blocks/captcha_form_user_billing_wave.tpl'),
),
'settings' => array(
array('group' => 'main', 'name' => 'oecaptchakey', 'type' => 'str', 'value' => ''),