I have created a new page on which I'd like my users to be able to login in via. All works well when the user enters valid information (they're logged in successfully), but if they enter the wrong email / password, they are redirected to the
/customer/account/login/ page. It is on this page that they're then shown the 'Invalid login or password' message in the the messages bar at the top of the page.
I'd obviously like the validation messages to appear at the top of my new page and not redirect the user. I thought that if I included the
page.messages container and the blocks within it, it would work. Unfortunately, it doesn't. Any ideas?
Here's a section of the xml for my new page:
<container name="newpage.login.container" htmlTag="div" htmlId="newpage-login-wrapper"> <container name="page.messages.newpage" htmlTag="div" htmlClass="page messages"> <block class="Magento\Framework\View\Element\Template" name="ajax.message.placeholder.newpage" template="Magento_Theme::html/messages.phtml"/> <block class="Magento\Framework\View\Element\Messages" name="messages.newpage" as="messages" template="Magento_Theme::messages.phtml"/> </container> <block class="Magento\Customer\Block\Form\Login" name="customer_form_login_checkout" template="Magento_Customer::form/login.phtml"> <container name="form.additional.info" as="form_additional_info"/> </block> </container>
The messages container and its content appears on the page, but it does nothing and the page is still redirected when the user tries to log in with incorrect details.