I have a client login popup on my page with the form

action="<?= $block->escapeUrl($block->getPostActionUrl()) ?>"

How can I change this so the form will not redirect to the account dashboard?

I have set to redirect "no" in the backend. Does not help.

Thank you.

Edit after Prince answer:

My problem is that I do not know where to start. I have found something in


It might control the login?

And this code?

            if (!$this->getScopeConfig()->getValue('customer/startup/redirect_dashboard') && $redirectRoute) {
            $response['redirectUrl'] = $this->_redirect->success($redirectRoute);

But if I want to stay on the same page after login (the user should have logged in status after ajax/reload)

And there are many other files that might be the right one? How can I locate the right one? (same problem all the time :( )


You do it in you controller, action="<?= $block->escapeUrl($block->getPostActionUrl()) ?>" is a controller post url, this url is set in your that module block.

When you post your form, the controller get that form params then it do some stuff and it redirect at the end, So you go to that controller then you change the url where you want to redirect after fail or success.

To get the controller url, you have to go the block module then you check getPostActionUrl(), or in console browser network (appear when submit a form).

Update :

1) The code :

if (!$this->getScopeConfig()->getValue('customer/startup/redirect_dashboard') && $redirectRoute) {
            $response['redirectUrl'] = $this->_redirect->success($redirectRoute);

mean :

If you haven't set a value in admin config : customer/startup/redirect_dashboard, it will redirect to the $redirectRoute Url.

2) Don't update vendor/magento/module-customer/..., you have to rewrite this controller or do an observer for that.

  • updated my question. – M2Newbie Nov 7 '18 at 7:17
  • @M2Newbie look my update – PЯINCƏ Nov 7 '18 at 13:28
  • Thank you for your help. I know I should not edit core files, but I can not find where to edit. I have changed different files called Login.php, replacing URL's. Nothing works. Any guidance to which file I should edit? – M2Newbie Nov 7 '18 at 14:46
  • did clean the cache ? – PЯINCƏ Nov 7 '18 at 14:46
  • yes I cleaned cache etc. Usually I get an error, but here nothing. I doubt I am editing the right file. – M2Newbie Nov 8 '18 at 8:32

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.