Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.4.2 #172

Merged
merged 10 commits into from
Apr 19, 2022
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>psgdpr</name>
<displayName><![CDATA[Official GDPR compliance]]></displayName>
<version><![CDATA[1.4.1]]></version>
<version><![CDATA[1.4.2]]></version>
<description><![CDATA[Make your store comply with the General Data Protection Regulation (GDPR).]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
Expand Down
10 changes: 8 additions & 2 deletions psgdpr.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
require_once $autoloadPath;
}

use PrestaShop\PrestaShop\Adapter\ServiceLocator;
use PrestaShop\PrestaShop\Core\Crypto\Hashing;

class Psgdpr extends Module
{
public $adminControllers = [
Expand Down Expand Up @@ -119,7 +122,7 @@ public function __construct()
// Settings
$this->name = 'psgdpr';
$this->tab = 'administration';
$this->version = '1.4.1';
$this->version = '1.4.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;

Expand Down Expand Up @@ -1055,13 +1058,16 @@ public function createAnonymousCustomer()
return true;
}

/** @var Hashing $crypto */
$crypto = ServiceLocator::get(Hashing::class);

// create an anonymous customer
$customer = new Customer();
$customer->id_gender = 1;
$customer->lastname = 'Anonymous';
$customer->firstname = 'Anonymous';
$customer->email = 'anonymous@psgdpr.com';
$customer->passwd = 'prestashop';
$customer->passwd = $crypto->hash(Tools::passwdGen(64)); // Generate a long random password
$customer->active = false;

if ($customer->save() == false) {
Expand Down
3 changes: 2 additions & 1 deletion tests/phpstan/phpstan-1.7.1.2.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ parameters:
- '#Parameter \#1 \$hook_name of method ModuleCore\:\:registerHook\(\) expects string, array<int, string> given.#'
- '#Parameter \#1 \$id of class Customer constructor expects null, int given.#'
- '#Parameter \#4 \$idShop of static method CMSCore\:\:getCMSPages\(\) expects null, int given.#'
- '#Parameter \#4 \$ssl of method LinkCore\:\:getModuleLink\(\) expects null, true given.#'
- '#Parameter \#4 \$ssl of method LinkCore\:\:getModuleLink\(\) expects null, true given\.#'
- '#Property CustomerCore\:\:\$passwd \(int\) does not accept string.#'
- '#^Strict comparison using === between int and ''prestashop'' will always evaluate to false\.$#'
45 changes: 45 additions & 0 deletions upgrade/upgrade-1.4.2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}

use PrestaShop\PrestaShop\Adapter\ServiceLocator;
use PrestaShop\PrestaShop\Core\Crypto\Hashing;

/**
* @param Psgdpr $module
*
* @return bool
*/
function upgrade_module_1_4_2($module)
{
// Only change password when it's "prestashop"
$customer = new Customer((int) Configuration::get('PSGDPR_ANONYMOUS_CUSTOMER'));
// @phpstan-ignore-next-line
if (Validate::isLoadedObject($customer) && $customer->passwd === 'prestashop') {
/** @var Hashing $crypto */
$crypto = ServiceLocator::get(Hashing::class);
$customer->passwd = $crypto->hash(Tools::passwdGen(64)); // Generate a long random password
$customer->save();
}

return true;
}
6 changes: 3 additions & 3 deletions views/templates/admin/tabs/getStarted.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<li>{l s='The right to give and withdraw consent' mod='psgdpr'}</li>
</ol>
<p>{l s='It also allows you to keep a record of processing activities (especially for access, consent and erasure).' mod='psgdpr'}</p>
<p><b>{l s='Follow our 3 steps to configure your module and help you to become GDPR compliant !' mod='psgdpr'}</b></p>
<p><b>{l s='Follow our 3 steps to configure your module and help you to become GDPR compliant!' mod='psgdpr'}</b></p>

<div class="row">
<div class="col-lg-1"></div>
Expand Down Expand Up @@ -69,7 +69,7 @@
<br>

<div role="alert" data-alert="info" class="alert alert-info">
{l s='Note : Please make sure that you have access to the latest version of your installed module(s) to fully benefit the features of our GDPR module. If one or several of your modules do not provide their data list, we invite you to contact directly the developers of these modules.' mod='psgdpr'}
{l s='Note: Please make sure that you have access to the latest version of your installed module(s) to fully benefit the features of our GDPR module. If one or several of your modules do not provide their data list, we invite you to contact directly the developers of these modules.' mod='psgdpr'}
</div>

<br>
Expand Down Expand Up @@ -114,6 +114,6 @@
</div>

<div role="alert" data-alert="info" class="alert alert-info">
{l s='Note : These features are intended to help you to become GDPR compliant. However using them does not guarantee that your site is fully compliant with GDPR requirements. It is ' mod='psgdpr'} <b>{l s='It is your own responsibility' mod='psgdpr'}</b> {l s='to configure the modules and take all necessary actions to ensure compliance. For any questions, we recommend you to contact a lawyer specializing in personal data legislation questions.' mod='psgdpr'}
{l s='Note: These features are intended to help you to become GDPR compliant. However using them does not guarantee that your site is fully compliant with GDPR requirements.' mod='psgdpr'} <b>{l s='It is your own responsibility' mod='psgdpr'}</b> {l s='to configure the modules and take all necessary actions to ensure compliance. For any questions, we recommend you to contact a lawyer specializing in personal data legislation questions.' mod='psgdpr'}
</div>
</div>