diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index fe6a5ca67..0bf29b534 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -43,7 +43,7 @@ class AuthControllerCore extends FrontController parent::init(); 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')) $this->create_account = true; @@ -318,7 +318,7 @@ class AuthControllerCore extends FrontController { if ($back = Tools::getValue('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)); } + + if ($back = Tools::getValue('back')) + Tools::redirect(html_entity_decode($back)); // redirection: if cart is not empty : redirection to the cart if (count($this->context->cart->getProducts(true)) > 0) Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping')); // else : redirection to the account else - Tools::redirect('index.php?controller=my-account'); + Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account')); } else $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 (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) Tools::redirect('index.php?controller=address'); + if ($back = Tools::getValue('back')) - Tools::redirect($back); - Tools::redirect('index.php?controller=my-account'); + Tools::redirect(html_entity_decode($back)); + // redirection: if cart is not empty : redirection to the cart if (count($this->context->cart->getProducts(true)) > 0) Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping')); // else : redirection to the account else - Tools::redirect('index.php?controller=my-account'); + Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account')); } } }