Jump to content

Wrong redirect after customer registration


Recommended Posts

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=1
register 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

  • 2 months later...
  • 2 years later...

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 !! 


class AuthController extends AuthControllerCore

    public function initContent()
        $should_redirect = false;

        if (Tools::isSubmit('submitCreate') || Tools::isSubmit('create_account')) {
            $register_form = $this

            if (Tools::isSubmit('submitCreate')) {
                $hookResult = array_reduce(
                    Hook::exec('actionSubmitAccountBefore', array(), null, true),
                    function ($carry, $item) {
                        return $carry && $item;
                if ($hookResult && $register_form->submit()) {
                    $should_redirect = true;
                    $this->redirect_after = ($this->authRedirection) ? urlencode($this->authRedirection) : 'my-account';

                'register_form' => $register_form->getProxy(),
                'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop'),
        } else {
            $login_form = $this->makeLoginForm()->fillWith(

            if (Tools::isSubmit('submitLogin')) {
                if ($login_form->submit()) {
                    $should_redirect = true;

                'login_form' => $login_form->getProxy(),


        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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...