insert Captcha also in the forgotten password form, as this is also often used for spam

This commit is contained in:
Daniel Seifert 2020-11-16 13:18:30 +01:00
parent 89d543156f
commit 087f912897
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
5 changed files with 52 additions and 3 deletions

View File

@ -1,3 +1,3 @@
[{$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()}]"/>
<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">
<span class="input-group-addon">
[{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

@ -39,6 +39,7 @@ $aModule = array(
'email' => '',
'extend' => array('details' => 'oe/captcha/controllers/oecaptchadetails',
'contact' => 'oe/captcha/controllers/oecaptchacontact',
'forgotpwd' => 'oe/captcha/controllers/oecaptchaforgotpwd',
'invite' => 'oe/captcha/controllers/oecaptchainvite',
'newsletter' => 'oe/captcha/controllers/oecaptchanewsletter',
'pricealarm' => 'oe/captcha/controllers/oecaptchapricealarm',
@ -57,6 +58,7 @@ $aModule = array(
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'),
),
'settings' => array(
array('group' => 'main', 'name' => 'oecaptchakey', 'type' => 'str', 'value' => ''),