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 ### Removed
- Suggest dropped out - 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 ## [2.0.4] - 22 Oct 2021

View File

@ -10,6 +10,8 @@ can submit the following forms:
- contact - contact
- invite - invite
- pricealarm (not bound in twig) - 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 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. 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 ```bash
composer require oxid-projects/captcha-module composer require oxid-projects/captcha-module
vendor/bin/oe-console oe:module:install source/modules/oe/captcha vendor/bin/oe-console oe:module:install source/modules/oe/captcha
# And activate
vendor/bin/oe-console oe:module:activate oecaptcha
``` ```
## Activate Module ## Activate Module
@ -51,6 +51,7 @@ vendor/bin/oe-console oe:module:activate oecaptcha
- Or use console - Or use console
```bash ```bash
vendor/bin/oe-console oe:module:activate oecaptcha vendor/bin/oe-console oe:module:activate oecaptcha
vendor/bin/oe-console oe:cache:clear
``` ```
## Uninstall ## Uninstall
@ -62,10 +63,12 @@ vendor/bin/oe-console oe:module:deactivate oecaptcha
If installed over composer (packagist): If installed over composer (packagist):
```bash ```bash
composer remove oxid-projects/captcha-module composer remove oxid-projects/captcha-module
vendor/bin/oe-console oe:cache:clear
``` ```
else if cloned: else if cloned:
```bash ```bash
vendor/bin/oe-console oe:module:uninstall oecaptcha vendor/bin/oe-console oe:module:uninstall oecaptcha
vendor/bin/oe-console oe:cache:clear
composer remove oxid-projects/captcha-module composer remove oxid-projects/captcha-module
composer config --unset repositories.oxid-projects/captcha-module composer config --unset repositories.oxid-projects/captcha-module
# and remove the source itself # 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', 'block' => 'captcha_form',
'file' => 'views/smarty/blocks/oe_captcha_form.tpl', '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' => [ 'settings' => [
[ [

View File

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