// Updated isTokenValid(). Thanks Olea.

This commit is contained in:
bMancone
2012-03-27 13:05:51 +00:00
parent feb7682e67
commit ba24216b82
3 changed files with 14 additions and 11 deletions
+4 -1
View File
@@ -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'));
} }
/** /**
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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