Yaya Posted April 24, 2018 Share Posted April 24, 2018 Hi all. I have noticed that when customers is creating a new account, once they confirm, they will redirect to the home page instead into the account. I think this is a Bug because I have check the file controllers/front/AuthController.php and it is correct: if ($this->context->customer->isLogged() && !$this->ajax) { $this->redirect_after = ($this->authRedirection) ? urlencode($this->authRedirection) : 'my-account'; $this->redirect(); } in that case should be redirect to the account instead it is moved to the Home Page. Go to : https://store.mellacoree.com/connexion?create_account=1register an account with email and password test you will be redirected to Home page instead account page could anyone help me? Link to comment Share on other sites More sharing options...
HouseofJewellery Posted June 29, 2018 Share Posted June 29, 2018 Still looking for a solution Link to comment Share on other sites More sharing options...
Eldewiny Posted August 11, 2020 Share Posted August 11, 2020 Hi, I know this question add it in early 2018 , But i have the same issue and my code it's exactly the same. Can anyone help me !! Link to comment Share on other sites More sharing options...
Eldewiny Posted August 18, 2020 Share Posted August 18, 2020 Ok Here is the answer, First of all , You will open controllers/front/AuthController.php and copy initContent function . Second create new AuthController in override/controllers/front and then the AuthController.php // Nots if you can not see this folders no problem you can create it. Than !! <?php class AuthController extends AuthControllerCore { public function initContent() { $should_redirect = false; if (Tools::isSubmit('submitCreate') || Tools::isSubmit('create_account')) { $register_form = $this ->makeCustomerForm() ->setGuestAllowed(false) ->fillWith(Tools::getAllValues()); if (Tools::isSubmit('submitCreate')) { $hookResult = array_reduce( Hook::exec('actionSubmitAccountBefore', array(), null, true), function ($carry, $item) { return $carry && $item; }, true ); if ($hookResult && $register_form->submit()) { $should_redirect = true; $this->redirect_after = ($this->authRedirection) ? urlencode($this->authRedirection) : 'my-account'; $this->redirect(); } } $this->context->smarty->assign([ 'register_form' => $register_form->getProxy(), 'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop'), ]); $this->setTemplate('customer/registration'); } else { $login_form = $this->makeLoginForm()->fillWith( Tools::getAllValues() ); if (Tools::isSubmit('submitLogin')) { if ($login_form->submit()) { $should_redirect = true; } } $this->context->smarty->assign([ 'login_form' => $login_form->getProxy(), ]); $this->setTemplate('customer/authentication'); } parent::initContent(); if ($should_redirect && !$this->ajax) { $back = urldecode(Tools::getValue('back')); if (Tools::urlBelongsToShop($back)) { // Checks to see if "back" is a fully qualified // URL that is on OUR domain, with the right protocol return $this->redirectWithNotifications($back); } // Well we're not redirecting to a URL, // so... if ($this->authRedirection) { // We may need to go there if defined return $this->redirectWithNotifications($this->authRedirection); } // go home return $this->redirectWithNotifications(__PS_BASE_URI__); } } } You can find the different between the two files just it is 2 lines more 😉 Thanks and i hope it was helpful . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now