[-] FO : Fix bug #PSCFV-8132 authRedirection not implemented and wrong back redirection

This commit is contained in:
gRoussac
2013-03-06 15:53:38 +01:00
parent 6cf5788e26
commit 7b55284231
+10 -6
View File
@@ -43,7 +43,7 @@ class AuthControllerCore extends FrontController
parent::init(); parent::init();
if (!Tools::getIsset('step') && $this->context->customer->isLogged() && !$this->ajax) if (!Tools::getIsset('step') && $this->context->customer->isLogged() && !$this->ajax)
Tools::redirect('index.php?controller=my-account'); Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
if (Tools::getValue('create_account')) if (Tools::getValue('create_account'))
$this->create_account = true; $this->create_account = true;
@@ -318,7 +318,7 @@ class AuthControllerCore extends FrontController
{ {
if ($back = Tools::getValue('back')) if ($back = Tools::getValue('back'))
Tools::redirect(html_entity_decode($back)); Tools::redirect(html_entity_decode($back));
Tools::redirect('index.php?controller=my-account'); Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
} }
} }
} }
@@ -448,12 +448,15 @@ class AuthControllerCore extends FrontController
); );
die(Tools::jsonEncode($return)); die(Tools::jsonEncode($return));
} }
if ($back = Tools::getValue('back'))
Tools::redirect(html_entity_decode($back));
// redirection: if cart is not empty : redirection to the cart // redirection: if cart is not empty : redirection to the cart
if (count($this->context->cart->getProducts(true)) > 0) if (count($this->context->cart->getProducts(true)) > 0)
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping')); Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account // else : redirection to the account
else else
Tools::redirect('index.php?controller=my-account'); Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
} }
else else
$this->errors[] = Tools::displayError('An error occurred while creating your account.'); $this->errors[] = Tools::displayError('An error occurred while creating your account.');
@@ -591,15 +594,16 @@ class AuthControllerCore extends FrontController
// if registration type is in two steps, we redirect to register address // if registration type is in two steps, we redirect to register address
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
Tools::redirect('index.php?controller=address'); Tools::redirect('index.php?controller=address');
if ($back = Tools::getValue('back')) if ($back = Tools::getValue('back'))
Tools::redirect($back); Tools::redirect(html_entity_decode($back));
Tools::redirect('index.php?controller=my-account');
// redirection: if cart is not empty : redirection to the cart // redirection: if cart is not empty : redirection to the cart
if (count($this->context->cart->getProducts(true)) > 0) if (count($this->context->cart->getProducts(true)) > 0)
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping')); Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account // else : redirection to the account
else else
Tools::redirect('index.php?controller=my-account'); Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
} }
} }
} }