// 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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user