I'm trying to see how to do this for the customer login process. After a customer enters the login credential, I'd like Magento to do the following. The login page is a custom page.
If login works, Magento logs in the customer and directs the page (or wherever).
If login fails, Magento does not redirect. Instead, it displays an error message on the current login page.
What are the proper procedures required for this? I think I need to make an AJAX request, but if I submit an AJAX request to log in, the returned response is just the HTML output string. So, that doesn't help to determine whether or not the login was successful. I don't want to encode a hidden string in the returned HTML and look for it in the HTML output.
Or, do I create a new controller action that the AJAX request that returns a page with a string (
false, for example) that can subsequently be used to display error messages on the current login screen?
Or, do I need use some kind of customer login API that returns true or false, depending on the login result?
Let me know if I need to clarify.