How Magento redirect the customer to account login controller form the account index controller?


In this case, you should check Magento\Customer\Controller\Plugin\Account and check the beforeDispatch() method.


This is the code which is responsible for redirecting the customer to the specified location after successful login.

    if (!$this->getScopeConfig()->getValue('customer/startup/redirect_dashboard') && $redirectUrl) {
         $resultRedirect = $this->resultRedirectFactory->create();
         // URL is checked to be internal in $this->_redirect->success()
         return $resultRedirect;

You can find the details in execute method in file vendor/magento/module-customer/Controller/Account/LoginPost.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.