1

I have a Magento 1.9 site and the customer login form does not work. when I try to login it just redirects back to the login page. when a user creates an account that works and they are automatically logged in. Also I am able to login to the admin panel. just not able to login as a customer.

I confirmed I am using the correct user/password and also confirmed that the form_key input is there.The customer login worked fine. However I recently moved the website from a VPS to an Amazon AWS cloud and that has been the only thing that has changed with this website. I confirmed I have php_mbstring installed and enabled.

Looking in the system.log I only see the below DEBUG (7): XML_ERROR: DEBUG (7): XML_ERROR:

Any suggestions?

2

I think that you have an issue with cookies

If the URL or domain of the site has changed in the migration, check the "Cookie Domain" setting in System >Config. You find it under General > Web > Session Cookie Management and it's called "Cookie Domain".

If this parameter doesn't match your site's actual domain name, what happens is that the login form is submitted, the user is logged in and a session cookie issues. The user's browser is then redirected to the protected page, but the cookie is not sent with the new request, so Magento believes the user has not yet logged in.

The main symptom to look for if it's a cookie domain issue is as follows:

The user submits the login form and when the form is displayed again there's no message indicating the user failed to log in. However, if they enter an incorrect username or password the message does appear.

Generally cookie domain can be left blank and the site works as expected.

  • The domain has not changed however I do have my domain written in the "cookie domain" field in the admin panel and cookie path I have set to / I am wondering maybe what is the cookie that needs to be set to login a customer? – Jayreis May 24 '17 at 22:04
  • 1
    Try to leave the field empty path and domain, Cookie restriction mode->No, Cookie lifetime->3600, clear your cache – PЯINCƏ May 24 '17 at 22:48
  • Still not wokrig may i know the any other possibilities of error. – Gem Apr 27 '18 at 7:06
1

You have to force Magento to use the same cookie domain in all cases. You can inspect your sites cookies using the developer tools in the FireFox or chrome browser.

This solution was tested on Magento 1.9.2.4

When the Session Cookie Management variables are not set incorrectly Magento may create two "frontend" cookies with different cookie domains. This typically happens during the login process when you have HTTPS (ie. SSL enabled) for the secure URL. Here are workable values for the Session cookie management configuration.

Cookie Life Time: 3600
Cookie Path: /
Cookie Domain : .mydomain.com (The dot prefix is important)
Use HTTP Only : No
Cookie Restriction Mode: No 
  1. In the admin panel go to System -> Configuration -> Web-> Session Cookie Management
  2. Set the Cookie Management configuration as shown above
  3. Save the configuration and clear the Magento cache
  4. Restart your web server to clear the PHP variables in case you made the change directly in MYSQL database
  5. Clear your browser cache to remove any existing cookies associated with your magento site.

Using the dot prefix on the cookie domain is important to prevent duplicate cookies from being created for the secure URL

Changing the cookie domain will also affect the "adminhtml" cookie used by the Magento back end. Make sure to clear your browser cache to prevent admin login problems.

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.