Finalized module for smarty, added more blocks in templates

This commit is contained in:
Gabriel Peleskei 2023-07-19 10:56:36 +00:00
parent e802847f06
commit 8926e6618d
7 changed files with 110 additions and 79 deletions

View File

@ -28,6 +28,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed
- Suggest dropped out
- /docs folder (no relevant information)
### Deprecated
- Tests won't work for this release and should be updated in the future.
## [2.0.4] - 22 Oct 2021

View File

@ -10,6 +10,8 @@ can submit the following forms:
- contact
- invite
- pricealarm (not bound in twig)
- newsletter (not bound in twig)
- forgotpwd (not bound in twig)
The captcha module then validates the submitted value against the expected one and then decides whether to process the
request (e.g. send contact mail to shop administrator) or refuse and show an error message instead.
@ -41,8 +43,6 @@ And install module:
```bash
composer require oxid-projects/captcha-module
vendor/bin/oe-console oe:module:install source/modules/oe/captcha
# And activate
vendor/bin/oe-console oe:module:activate oecaptcha
```
## Activate Module
@ -51,6 +51,7 @@ vendor/bin/oe-console oe:module:activate oecaptcha
- Or use console
```bash
vendor/bin/oe-console oe:module:activate oecaptcha
vendor/bin/oe-console oe:cache:clear
```
## Uninstall
@ -62,10 +63,12 @@ vendor/bin/oe-console oe:module:deactivate oecaptcha
If installed over composer (packagist):
```bash
composer remove oxid-projects/captcha-module
vendor/bin/oe-console oe:cache:clear
```
else if cloned:
```bash
vendor/bin/oe-console oe:module:uninstall oecaptcha
vendor/bin/oe-console oe:cache:clear
composer remove oxid-projects/captcha-module
composer config --unset repositories.oxid-projects/captcha-module
# and remove the source itself

View File

@ -1,36 +0,0 @@
==Title==
OE Captcha
==Author==
OXID eSales AG
==Prefix==
oe
==Shop Version==
6.x
==Version==
1.0.0
==Link==
http://www.oxid-esales.com/
==Mail==
==Description==
OE Captcha Module
==Installation==
Activate the module in administration area.
==Extend==
==Modules==
==Modified original templates==
==Uninstall==
Disable the module in administration area and delete module folder.

View File

@ -73,6 +73,16 @@ $aModule = [
'block' => 'captcha_form',
'file' => 'views/smarty/blocks/oe_captcha_form.tpl',
],
[
'template' => 'form/newsletter.tpl',
'block' => 'captcha_form',
'file' => 'views/smarty/blocks/oe_captcha_form.tpl',
],
[
'template' => 'form/forgotpwd_email.tpl',
'block' => 'captcha_form',
'file' => 'views/smarty/blocks/oe_captcha_form.tpl',
],
],
'settings' => [
[

View File

@ -1,20 +1,47 @@
[{assign var="oCaptcha" value=$oView->getOeCaptcha()}]
<input type="hidden" name="c_mach" value="[{$oCaptcha->getHash()}]" />
[{assign var="oCaptcha" value=$oView->getCaptcha()}]
[{block name="body"}]
[{block name="style"}]
<style>
.oecaptcha-group {display: flex; align-items: center; gap: 2ch;}
.oecaptcha-container {display: grid; place-items: center;}
</style>
[{/block}]
<div class="form-group verify">
<label class="req control-label col-lg-2" for="c_mac">[{oxmultilang ident="VERIFICATION_CODE"}]</label>
[{block name="hidden"}]
<input type="hidden" name="c_mach" value="[{$oCaptcha->getHash()}]" />
[{/block}]
<div class="col-lg-10 controls">
<div class="input-group">
<span class="input-group-addon">
[{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>
[{block name="form_group"}]
<div class="form-group verify oecaptcha">
[{block name="label"}]
<label class="req control-label col-lg-2" for="c_mac">[{oxmultilang ident="VERIFICATION_CODE"}]</label>
[{/block}]
[{block name="input_control"}]
<div class="col-lg-10 controls oecaptcha-group-container">
[{block name="input_group"}]
<div class="input-group oecaptcha-group">
[{block name="image_group"}]
<span class="input-group-addon oecaptcha-container">
[{if $oCaptcha->isImageVisible()}]
[{block name="image_visible"}]
<img src="[{$oCaptcha->getImageUrl()}]" alt="">
[{/block}]
[{else}]
[{block name="image_hidden"}]
<span class="verificationCode" id="verifyTextCode">[{$oCaptcha->getText()}]</span>
[{/block}]
[{/if}]
</span>
[{/block}]
[{block name="input"}]
<input type="text" data-fieldsize="verify" name="c_mac" value=""
class="form-control js-oxValidate js-oxValidate_notEmpty" required>
[{/block}]
</div>
[{/block}]
</div>
[{/block}]
</div>
[{/block}]
[{/block}]

View File

@ -1,26 +1,49 @@
{% set oCaptcha = oView.getCaptcha() %}
<input type="hidden" name="c_mach" value="{{ oCaptcha.getHash() }}" />
{% block style %}
<style>
.oecaptcha {padding: 0 .75rem;}
.oecaptcha-group {display: flex; align-items: center; gap: 2ch;}
.oecaptcha-container {display: grid; place-items: center;}
</style>
{% endblock %}
<div class="form-group verify oecaptcha mb-3">
<label class="req control-label col-lg-2" for="c_mac">{{ translate({ ident: "VERIFICATION_CODE" }) }}</label>
{% block body %}
{% block style %}
<style>
.oecaptcha {padding: 0 .75rem;}
.oecaptcha-group {display: flex; align-items: center; gap: 2ch;}
.oecaptcha-container {display: grid; place-items: center;}
</style>
{% endblock %}
{% block hidden %}
<input type="hidden" name="c_mach" value="{{ oCaptcha.getHash() }}" />
{% endblock %}
{% block form_group %}
<div class="form-group verify oecaptcha mb-3">
{% block label %}
<label class="req control-label col-lg-2" for="c_mac">{{ translate({ ident: "VERIFICATION_CODE" }) }}</label>
{% endblock %}
<div class="col-lg-10 controls oecaptcha-group-container">
<div class="input-group oecaptcha-group">
<span class="input-group-addon oecaptcha-container">
{% if oCaptcha.isImageVisible() %}
<img src="{{ oCaptcha.getImageUrl() }}" alt="">
{% else %}
<span class="verificationCode" id="verifyTextCode">{{ oCaptcha.getText() }}</span>
{% endif %}
</span>
<input type="text" data-fieldsize="verify" name="c_mac" value="" placeholder="{{ translate({ ident: "OECAPTCHA_PLACEHOLDER" }) }}"
class="form-control js-oxValidate js-oxValidate_notEmpty" required>
</div>
{% block input_control %}
<div class="col-lg-10 controls oecaptcha-group-container">
{% block input_group %}
<div class="input-group oecaptcha-group">
{% block image_group %}
<span class="input-group-addon oecaptcha-container">
{% if oCaptcha.isImageVisible() %}
{% block image_visible %}
<img src="{{ oCaptcha.getImageUrl() }}" alt="">
{% endblock %}
{% else %}
{% block image_hidden %}
<span class="verificationCode" id="verifyTextCode">{{ oCaptcha.getText() }}</span>
{% endblock %}
{% endif %}
</span>
{% endblock %}
{% block input %}
<input type="text" data-fieldsize="verify" name="c_mac" value="" placeholder="{{ translate({ ident: "OECAPTCHA_PLACEHOLDER" }) }}"
class="form-control js-oxValidate js-oxValidate_notEmpty" required>
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock %}
</div>
</div>
{% endblock %}
{% endblock %}