// Updated isTokenValid(). Thanks Olea.

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14296 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
bMancone committed 2012-03-27 13:05:51 +00:00
1 parent a08e3fb871
commit 42385b2cbc
3 files changed
+6 -3

No files matched your search

+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