On change de module de Captcha
This commit is contained in:
2
modules/eicaptcha/.gitignore
vendored
Normal file
2
modules/eicaptcha/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
vendor
|
||||
composer.lock
|
||||
27
modules/eicaptcha/README.md
Normal file
27
modules/eicaptcha/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# eicaptcha
|
||||
Module EiCaptcha for prestashop 1.7
|
||||
|
||||
This module display Google recaptcha on the following forms :
|
||||
- contact form
|
||||
- account creation form
|
||||
|
||||
This module relies upon the override of the folowing files :
|
||||
- AuthController
|
||||
- ContactForm Module
|
||||
|
||||
The last version used composer to get recaptcha lib.
|
||||
Don't forget to use `composer update` in order to download the necessary recaptcha composer package.
|
||||
Otherwise you can go on the github release page https://github.com/nenes25/eicaptcha/releases and download the last 2.0.x version release to get the full package
|
||||
|
||||
Screenshots
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
Captcha on contact form <br />
|
||||
<img src="https://www.h-hennes.fr/blog/wp-content/uploads/2017/07/eicaptcha-17-contact.jpg" alt="Captcha Contact Form" />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Captcha on account creation form <br />
|
||||
<img src="https://www.h-hennes.fr/blog/wp-content/uploads/2017/07/eicaptcha-17-account.jpg" alt="Captcha on account creation form" />
|
||||
</p>
|
||||
9
modules/eicaptcha/changelog.txt
Normal file
9
modules/eicaptcha/changelog.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Module Captcha
|
||||
* Add (re)captcha on contact and account creation forms
|
||||
* © h-hennes 2013-2017
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*/
|
||||
|
||||
- V 2.0.0 - 2017-07-10 : New version for prestashop 1.7, add only captcha for contact form and account creation
|
||||
- V 2.0.1 - 2017-12-01 : Css improvments thanks to Arnaud Merigeau
|
||||
25
modules/eicaptcha/composer.json
Normal file
25
modules/eicaptcha/composer.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "nenes25/eicaptcha",
|
||||
"description": "PrestaShop Captcha Module",
|
||||
"homepage": "https://github.com/nenes25/eicaptcha",
|
||||
"license": "AFL - Academic Free License (AFL 3.0)",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Hhennes",
|
||||
"email": "contact@h-hennes.fr"
|
||||
},
|
||||
{
|
||||
"name": "drzraf",
|
||||
"email": "raphael.droz@gmail.com"
|
||||
}
|
||||
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"google/recaptcha": "~1.1"
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist"
|
||||
},
|
||||
"type": "prestashop-module"
|
||||
}
|
||||
348
modules/eicaptcha/eicaptcha.php
Normal file
348
modules/eicaptcha/eicaptcha.php
Normal file
@@ -0,0 +1,348 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author Hennes Hervé <contact@h-hennes.fr>
|
||||
* @copyright 2013-2017 Hennes Hervé
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class EiCaptcha extends Module
|
||||
{
|
||||
private $_html = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->author = 'hhennes';
|
||||
$this->name = 'eicaptcha';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '2.0.1';
|
||||
$this->need_instance = 1;
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Ei Captcha');
|
||||
$this->description = $this->l('Add a captcha to your website form');
|
||||
|
||||
if ($this->active && (!Configuration::get('CAPTCHA_PUBLIC_KEY') || !Configuration::get('CAPTCHA_PRIVATE_KEY'))) {
|
||||
$this->warning = $this->l('Captcha Module need to be configurated');
|
||||
}
|
||||
$this->themes = array( 0 => 'light', 1 => 'dark');
|
||||
$this->dependencies = array('contactform');
|
||||
$this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('header')
|
||||
|| !$this->registerHook('displayCustomerAccountForm')
|
||||
|| !$this->registerHook('actionContactFormSubmitCaptcha')
|
||||
|| !$this->registerHook('actionContactFormSubmitBefore')
|
||||
|| !Configuration::updateValue('CAPTCHA_ENABLE_ACCOUNT', 0)
|
||||
|| !Configuration::updateValue('CAPTCHA_ENABLE_CONTACT', 0)
|
||||
|| !Configuration::updateValue('CAPTCHA_THEME', 0)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
if (!parent::uninstall()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Configuration::deleteByName('CAPTCHA_PUBLIC_KEY') || !Configuration::deleteByName('CAPTCHA_PRIVATE_KEY') || !Configuration::deleteByName('CAPTCHA_ENABLE_ACCOUNT')
|
||||
|| !Configuration::deleteByName('CAPTCHA_ENABLE_CONTACT') || !Configuration::deleteByName('CAPTCHA_FORCE_LANG') || !Configuration::deleteByName('CAPTCHA_THEME')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Process in back office
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('SubmitCaptchaConfiguration')) {
|
||||
Configuration::updateValue('CAPTCHA_PUBLIC_KEY', Tools::getValue('CAPTCHA_PUBLIC_KEY'));
|
||||
Configuration::updateValue('CAPTCHA_PRIVATE_KEY', Tools::getValue('CAPTCHA_PRIVATE_KEY'));
|
||||
Configuration::updateValue('CAPTCHA_ENABLE_ACCOUNT', (int) Tools::getValue('CAPTCHA_ENABLE_ACCOUNT'));
|
||||
Configuration::updateValue('CAPTCHA_ENABLE_CONTACT', (int) Tools::getValue('CAPTCHA_ENABLE_CONTACT'));
|
||||
Configuration::updateValue('CAPTCHA_FORCE_LANG', Tools::getValue('CAPTCHA_FORCE_LANG'));
|
||||
Configuration::updateValue('CAPTCHA_THEME', (int)Tools::getValue('CAPTCHA_THEME'));
|
||||
|
||||
$this->_html .= $this->displayConfirmation($this->l('Settings updated'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Module Configuration in Back Office
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
$this->_html .=$this->postProcess();
|
||||
$this->_html .= $this->renderForm();
|
||||
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Form for module Configuration
|
||||
*/
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Eicaptcha Configuration'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'description' => $this->l('To get your own public and private keys please click on the folowing link').'<br /><a href="https://www.google.com/recaptcha/intro/index.html" target="_blank">https://www.google.com/recaptcha/intro/index.html</a>',
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Captcha public key (Site key)'),
|
||||
'name' => 'CAPTCHA_PUBLIC_KEY',
|
||||
'required' => true,
|
||||
'empty_message' => $this->l('Please fill the captcha public key'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Captcha private key (Secret key)'),
|
||||
'name' => 'CAPTCHA_PRIVATE_KEY',
|
||||
'required' => true,
|
||||
'empty_message' => $this->l('Please fill the captcha private key'),
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Enable Captcha for contact form'),
|
||||
'name' => 'CAPTCHA_ENABLE_CONTACT',
|
||||
'required' => true,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value'=> 1,
|
||||
'label'=> $this->l('Enabled'),
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value'=> 0,
|
||||
'label'=> $this->l('Disabled'),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Enable Captcha for account creation'),
|
||||
'name' => 'CAPTCHA_ENABLE_ACCOUNT',
|
||||
'required' => true,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value'=> 1,
|
||||
'label'=> $this->l('Enabled'),
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value'=> 0,
|
||||
'label'=> $this->l('Disabled'),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Force Captcha language'),
|
||||
'hint' => $this->l('Language code ( en-GB | fr | de | de-AT | ... ) - Leave empty for autodetect'),
|
||||
'desc' => $this->l('For available language codes see: https://developers.google.com/recaptcha/docs/language'),
|
||||
'name' => 'CAPTCHA_FORCE_LANG',
|
||||
'required' => false,
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Theme'),
|
||||
'name' => 'CAPTCHA_THEME',
|
||||
'required' => true,
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'clight',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Light'),
|
||||
),
|
||||
array(
|
||||
'id' => 'cdark',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Dark'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'button btn btn-default pull-right',
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$helper->id = 'eicaptcha';
|
||||
//$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'SubmitCaptchaConfiguration';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config values to hydrate the helperForm
|
||||
*/
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'CAPTCHA_PRIVATE_KEY' => Tools::getValue('CAPTCHA_PRIVATE_KEY', Configuration::get('CAPTCHA_PRIVATE_KEY')),
|
||||
'CAPTCHA_PUBLIC_KEY' => Tools::getValue('CAPTCHA_PUBLIC_KEY', Configuration::get('CAPTCHA_PUBLIC_KEY')),
|
||||
'CAPTCHA_ENABLE_ACCOUNT' => Tools::getValue('CAPTCHA_ENABLE_ACCOUNT', Configuration::get('CAPTCHA_ENABLE_ACCOUNT')),
|
||||
'CAPTCHA_ENABLE_CONTACT' => Tools::getValue('CAPTCHA_ENABLE_CONTACT', Configuration::get('CAPTCHA_ENABLE_CONTACT')),
|
||||
'CAPTCHA_FORCE_LANG' => Tools::getValue('CAPTCHA_FORCE_LANG', Configuration::get('CAPTCHA_FORCE_LANG')),
|
||||
'CAPTCHA_THEME' => Tools::getValue('CAPTCHA_THEME', Configuration::get('CAPTCHA_THEME')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook Header
|
||||
*/
|
||||
public function hookHeader($params)
|
||||
{
|
||||
//Add Content box to contact form page in order to display captcha
|
||||
if ( $this->context->controller instanceof ContactController
|
||||
&& Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1
|
||||
) {
|
||||
|
||||
$this->context->controller->registerJavascript(
|
||||
'modules-eicaptcha-contact-form',
|
||||
'modules/'.$this->name.'/views/js/eicaptcha-contact-form.js'
|
||||
);
|
||||
$this->context->controller->registerStylesheet(
|
||||
'module-eicaptcha',
|
||||
'modules/'.$this->name.'/views/css/eicaptcha.css'
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->context->controller instanceof ContactController
|
||||
|| $this->context->controller instanceof AuthController
|
||||
) {
|
||||
|
||||
$this->context->controller->registerStylesheet(
|
||||
'module-eicaptcha',
|
||||
'modules/'.$this->name.'/views/css/eicaptcha.css'
|
||||
);
|
||||
|
||||
//Dynamic insertion of the content
|
||||
$js = '<script type="text/javascript">
|
||||
//Recaptcha CallBack Function
|
||||
var onloadCallback = function() {try { grecaptcha.render("captcha-box", {"theme" : "' . $this->themes[Configuration::get('CAPTCHA_THEME')] . '", "sitekey" : "' . Configuration::get('CAPTCHA_PUBLIC_KEY') . '"});} catch(error){}};
|
||||
</script>';
|
||||
|
||||
$js .= '<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=' . Configuration::get('CAPTCHA_FORCE_LANG') . '" async defer></script>';
|
||||
|
||||
return $js;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Captcha on the Customer Registration Form
|
||||
*/
|
||||
public function hookDisplayCustomerAccountForm($params)
|
||||
{
|
||||
if (Configuration::get('CAPTCHA_ENABLE_ACCOUNT') == 1) {
|
||||
$this->context->smarty->assign('publicKey', Configuration::get('CAPTCHA_PUBLIC_KEY'));
|
||||
$this->context->smarty->assign('captchaforcelang', Configuration::get('CAPTCHA_FORCE_LANG'));
|
||||
$this->context->smarty->assign('captchatheme', $this->themes[Configuration::get('CAPTCHA_THEME')]);
|
||||
return $this->display(__FILE__, 'views/templates/hook/hookDisplayCustomerAccountForm.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check captcha before submit account
|
||||
* Custom hook
|
||||
* @param type $params
|
||||
* @return boolean
|
||||
*/
|
||||
public function hookActionContactFormSubmitCaptcha($params)
|
||||
{
|
||||
if ( Configuration::get('CAPTCHA_ENABLE_ACCOUNT') == 1) {
|
||||
$this->_validateCaptcha();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check captcha before submit contact form
|
||||
* new custom hook
|
||||
* @return int
|
||||
*/
|
||||
public function hookActionContactFormSubmitBefore()
|
||||
{
|
||||
if (Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1) {
|
||||
$this->_validateCaptcha();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Captcha
|
||||
*/
|
||||
protected function _validateCaptcha()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
$captcha = new \ReCaptcha\ReCaptcha(Configuration::get('CAPTCHA_PRIVATE_KEY'));
|
||||
$result = $captcha->verify(Tools::getValue('g-recaptcha-response'),
|
||||
Tools::getRemoteAddr());
|
||||
|
||||
if (! $result->isSuccess()) {
|
||||
$context->controller->errors[] = $this->l('Please validate the captcha field before submitting your request');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
9
modules/eicaptcha/fr.php
Normal file
9
modules/eicaptcha/fr.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_3e87eed4786fe702ae961b55bbf02c6a'] = '(Re)Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_793b58515cefe26f6a3c5ab782460a69'] = 'Le mode Captcha doit être configuré';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_77f682c46c4c98d39cfb703d3606f505'] = 'Pour récupérer vos propres clés, merci de cliquer sur le lien suivant';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_632ee8e447c5c09ca7577f9281cbb999'] = 'Veuillez répondre tout d\'abord à la question de sécurité plus bas.';
|
||||
$_MODULE['<{eicaptcha}prestashop>hookdisplaycustomeraccountform_45d048c35e3cfd449dc0a1b503cd103a'] = 'Vérification de sécurité';
|
||||
35
modules/eicaptcha/index.php
Normal file
35
modules/eicaptcha/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
BIN
modules/eicaptcha/logo.png
Normal file
BIN
modules/eicaptcha/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
class AuthController extends AuthControllerCore
|
||||
{
|
||||
|
||||
/**
|
||||
* Surcharge specifique eicaptcha
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
if ( Tools::isSubmit('submitCreate') ) {
|
||||
Hook::exec('actionContactFormSubmitCaptcha');
|
||||
|
||||
if ( ! sizeof( $this->context->controller->errors ) ) {
|
||||
parent::initContent();
|
||||
} else {
|
||||
$register_form = $this
|
||||
->makeCustomerForm()
|
||||
->setGuestAllowed(false)
|
||||
->fillWith(Tools::getAllValues());
|
||||
|
||||
FrontController::initContent();
|
||||
|
||||
$this->context->smarty->assign([
|
||||
'register_form' => $register_form->getProxy(),
|
||||
'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop')
|
||||
]);
|
||||
$this->setTemplate('customer/registration');
|
||||
}
|
||||
} else {
|
||||
parent::initContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
35
modules/eicaptcha/override/controllers/front/index.php
Normal file
35
modules/eicaptcha/override/controllers/front/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
35
modules/eicaptcha/override/index.php
Normal file
35
modules/eicaptcha/override/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class ContactformOverride extends Contactform
|
||||
{
|
||||
|
||||
public function sendMessage() {
|
||||
|
||||
//Module Eicaptcha : Check captcha before submit
|
||||
Hook::exec('actionContactFormSubmitBefore');
|
||||
if ( !sizeof($this->context->controller->errors)) {
|
||||
parent::sendMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
35
modules/eicaptcha/override/modules/index.php
Normal file
35
modules/eicaptcha/override/modules/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
12
modules/eicaptcha/views/css/eicaptcha.css
Normal file
12
modules/eicaptcha/views/css/eicaptcha.css
Normal file
@@ -0,0 +1,12 @@
|
||||
.contact-form form .form-fields #captcha-box > div{float: right;}
|
||||
.contact-form form .form-footer{clear: both;padding-top: 1rem;}
|
||||
@media screen and (max-width: 767px){
|
||||
#contact #left-column,
|
||||
#contact #content-wrapper{padding-left: 0!important;padding-right: 0!important;width: 100%;}
|
||||
.contact-form form .form-fields #captcha-box{position: relative;min-height: 78px;}
|
||||
.contact-form form .form-fields #captcha-box > div{float: none;position: absolute;left: 50%;top: 0;transform: translate(-50%,0);}
|
||||
}
|
||||
@media screen and (max-width: 379px){
|
||||
.register-form form .form-group .g-recaptcha{position: relative;min-height: 78px;}
|
||||
.register-form form .form-group .g-recaptcha > div{float: none;position: absolute;left: 50%;top: 0;transform: translate(-50%,0);}
|
||||
}
|
||||
35
modules/eicaptcha/views/index.php
Normal file
35
modules/eicaptcha/views/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
4
modules/eicaptcha/views/js/eicaptcha-contact-form.js
Normal file
4
modules/eicaptcha/views/js/eicaptcha-contact-form.js
Normal file
@@ -0,0 +1,4 @@
|
||||
$(document).ready(function () {
|
||||
$('.form-fields').append('<div id="captcha-box"></div>');
|
||||
});
|
||||
|
||||
35
modules/eicaptcha/views/js/index.php
Normal file
35
modules/eicaptcha/views/js/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,36 @@
|
||||
{*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author Hennes Hervé <contact@h-hennes.fr>
|
||||
* @copyright Hennes Hervé
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*}
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 form-control-label">{l s='Captcha' mod='eicaptcha'}</label>
|
||||
{**
|
||||
* Le contenu du captcha est automatiquement ajouté dans le selecteur #captcha-box
|
||||
* Captcha content is automaticaly added into the selector #captcha-box
|
||||
*}
|
||||
<div class="col-md-9">
|
||||
<div class="g-recaptcha" data-sitekey="{$publicKey|escape:'html'}" id="captcha-box" data-theme="{$captchatheme}"></div>
|
||||
</div>
|
||||
<script src="https://www.google.com/recaptcha/api.js?hl={$captchaforcelang}" async defer></script>
|
||||
</div>
|
||||
35
modules/eicaptcha/views/templates/hook/index.php
Normal file
35
modules/eicaptcha/views/templates/hook/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
35
modules/eicaptcha/views/templates/index.php
Normal file
35
modules/eicaptcha/views/templates/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
Reference in New Issue
Block a user