Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions psgdpr.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,10 @@ public function getContent()
'id_shop' => $id_shop,
'module_version' => $this->version,
'moduleAdminLink' => $moduleAdminLink,
'link' => $this->context->link,
'id_lang' => $id_lang,
'api_controller' => $this->getAdminLinkWithoutToken($apiController),
'admin_token' => $this->getTokenFromAdminLink($apiController),
'admin_token' => Tools::getAdminTokenLite('AdminModules'),
'faq' => $this->loadFaq(),
'doc' => $this->getReadmeByLang($isoLang),
'youtubeLink' => $this->getYoutubeLinkByLang($isoLang),
Expand Down Expand Up @@ -357,24 +358,6 @@ private function getAdminLinkWithoutToken(string $link): string
return substr($link, 0, $pos);
}

/**
* Get token from an admin controller link
*
* @param string $link
*
* @return string
*/
public function getTokenFromAdminLink(string $link): string
{
parse_str((string) parse_url($link, PHP_URL_QUERY), $result);

if (is_array($result['_token'])) {
throw new \PrestaShopException('Invalid token');
}

return $result['_token'];
}

/**
* load dependencies in the configuration of the module
*
Expand Down
8 changes: 7 additions & 1 deletion views/js/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
$(window).ready(function () {
moduleAdminLink = moduleAdminLink.replace(/\amp;/g, "");

function setQueryParameter(url, key, value) {
const u = new URL(url, window.location.origin);
u.searchParams.set(key, value);
return u.toString();
}

window.vMenu = new Vue({
el: "#psgdpr-menu",
data: {
Expand All @@ -27,7 +33,7 @@ $(window).ready(function () {
methods: {
makeActive: function (item) {
this.selectedTabName = item;
window.history.pushState({}, "", moduleAdminLink + "&page=" + item);
window.history.pushState({}, "", setQueryParameter(moduleAdminLink, "page", item));
},
isActive: function (item) {
if (this.selectedTabName == item) {
Expand Down
9 changes: 4 additions & 5 deletions views/templates/admin/tabs/dataConfig.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
* 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)
*}

* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*}
<div class="panel col-lg-10 right-panel">
<h3>
<i class="fa fa-cogs"></i> {l s='Data visualization and automatic actions' d='Modules.Psgdpr.Admin'} <small>{$module_display|escape:'htmlall':'UTF-8'}</small>
</h3>
<form method="post" action="{$moduleAdminLink|escape:'htmlall':'UTF-8'}&page=account" class="form-horizontal">
<form method="post" action="{$link->getAdminLink('AdminModules', true, [], ['configure' => 'psgdpr', 'page' => 'account'])|escape:'htmlall':'UTF-8'}" class="form-horizontal">
<div>
<p>{l s='Find here listed all personal data collected by PrestaShop and your installed modules.' d='Modules.Psgdpr.Admin'}</p>
<p>{l s='These data will be used at 2 different levels :' d='Modules.Psgdpr.Admin'}</p>
Expand Down
8 changes: 4 additions & 4 deletions views/templates/admin/tabs/dataConsent.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
* 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)
*}
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*}
<div class="panel col-lg-10 right-panel">
<h3>
<i class="fa fa-wrench"></i> {l s='Configure your checkboxes' d='Modules.Psgdpr.Admin'} <small>{$module_display|escape:'htmlall':'UTF-8'}</small>
</h3>
<form method="post" action="{$moduleAdminLink|escape:'htmlall':'UTF-8'}&page=dataConsent" class="form-horizontal">
<form method="post" action="{$link->getAdminLink('AdminModules', true, [], ['configure' => 'psgdpr', 'page' => 'dataConsent'])|escape:'htmlall':'UTF-8'}" class="form-horizontal">
<div>
<p>{l s='Please customize your consent request messages in the dedicated fields below :' d='Modules.Psgdpr.Admin'}</p>
<article class="alert alert-info" role="alert" data-alert="info">
Expand Down
Loading