// Updated isTokenValid(). Thanks Olea.
This commit is contained in:
@@ -881,7 +881,10 @@ class FrontControllerCore extends Controller
|
|||||||
*/
|
*/
|
||||||
public function isTokenValid()
|
public function isTokenValid()
|
||||||
{
|
{
|
||||||
return Configuration::get('PS_TOKEN_ENABLE') && strcasecmp(Tools::getToken(false), Tools::getValue('token')) && $this->context->customer->isLogged();
|
if (!Configuration::get('PS_TOKEN_ENABLE'))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return strcasecmp(Tools::getToken(false), Tools::getValue('token'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class AddressControllerCore extends FrontController
|
|||||||
$address->id_customer = (int)$this->context->customer->id;
|
$address->id_customer = (int)$this->context->customer->id;
|
||||||
|
|
||||||
// Check page token
|
// Check page token
|
||||||
if ($this->isTokenValid())
|
if ($this->context->customer->isLogged() && !$this->isTokenValid())
|
||||||
$this->errors[] = Tools::displayError('Invalid token');
|
$this->errors[] = Tools::displayError('Invalid token');
|
||||||
|
|
||||||
// Check phone
|
// Check phone
|
||||||
@@ -175,7 +175,7 @@ class AddressControllerCore extends FrontController
|
|||||||
$this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
|
$this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
|
||||||
else if (!$country->isNeedDni())
|
else if (!$country->isNeedDni())
|
||||||
$address->dni = null;
|
$address->dni = null;
|
||||||
|
|
||||||
// Check if the alias exists
|
// Check if the alias exists
|
||||||
if (!empty($_POST['alias'])
|
if (!empty($_POST['alias'])
|
||||||
&& (int)$this->context->customer->id > 0
|
&& (int)$this->context->customer->id > 0
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class CartControllerCore extends FrontController
|
|||||||
protected $id_address_delivery;
|
protected $id_address_delivery;
|
||||||
protected $customization_id;
|
protected $customization_id;
|
||||||
protected $qty;
|
protected $qty;
|
||||||
|
|
||||||
protected $ajax_refresh = false;
|
protected $ajax_refresh = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,7 +62,7 @@ class CartControllerCore extends FrontController
|
|||||||
|
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
if ($this->isTokenValid())
|
if ($this->context->customer->isLogged() && !$this->isTokenValid())
|
||||||
$this->errors[] = Tools::displayError('Invalid token');
|
$this->errors[] = Tools::displayError('Invalid token');
|
||||||
|
|
||||||
// Update the cart ONLY if $this->cookies are available, in order to avoid ghost carts created by bots
|
// Update the cart ONLY if $this->cookies are available, in order to avoid ghost carts created by bots
|
||||||
@@ -122,7 +122,7 @@ class CartControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
if (!Configuration::get('PS_ALLOW_MULTISHIPPING'))
|
if (!Configuration::get('PS_ALLOW_MULTISHIPPING'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$old_id_address_delivery = (int)Tools::getValue('old_id_address_delivery');
|
$old_id_address_delivery = (int)Tools::getValue('old_id_address_delivery');
|
||||||
$new_id_address_delivery = (int)Tools::getValue('new_id_address_delivery');
|
$new_id_address_delivery = (int)Tools::getValue('new_id_address_delivery');
|
||||||
|
|
||||||
@@ -132,15 +132,15 @@ class CartControllerCore extends FrontController
|
|||||||
$old_id_address_delivery,
|
$old_id_address_delivery,
|
||||||
$new_id_address_delivery);
|
$new_id_address_delivery);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function processAllowSeperatedPackage()
|
protected function processAllowSeperatedPackage()
|
||||||
{
|
{
|
||||||
if (!Configuration::get('PS_SHIP_WHEN_AVAILABLE'))
|
if (!Configuration::get('PS_SHIP_WHEN_AVAILABLE'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Tools::getValue('value') === false)
|
if (Tools::getValue('value') === false)
|
||||||
die('{"error":true, "error_message": "No value setted"}');
|
die('{"error":true, "error_message": "No value setted"}');
|
||||||
|
|
||||||
$this->context->cart->allow_seperated_package = (boolean)Tools::getValue('value');
|
$this->context->cart->allow_seperated_package = (boolean)Tools::getValue('value');
|
||||||
$this->context->cart->update();
|
$this->context->cart->update();
|
||||||
die('{"error":false}');
|
die('{"error":false}');
|
||||||
@@ -150,7 +150,7 @@ class CartControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
if (!Configuration::get('PS_ALLOW_MULTISHIPPING'))
|
if (!Configuration::get('PS_ALLOW_MULTISHIPPING'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!$this->context->cart->duplicateProduct(
|
if (!$this->context->cart->duplicateProduct(
|
||||||
$this->id_product,
|
$this->id_product,
|
||||||
$this->id_product_attribute,
|
$this->id_product_attribute,
|
||||||
@@ -237,7 +237,7 @@ class CartControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$removed = CartRule::autoRemoveFromCart();
|
$removed = CartRule::autoRemoveFromCart();
|
||||||
if (count($removed) && (int)Tools::getValue('allow_refresh'))
|
if (count($removed) && (int)Tools::getValue('allow_refresh'))
|
||||||
$this->ajax_refresh = true;
|
$this->ajax_refresh = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user