0

Here is proper explanation of Issue that I am facing on Magento 1.9.2.4

I have made custom popups to register and login customer, I have put extended Mage_Customer_AccountController class from my custom module, and simply register customer and login him after it. not more complex customizations.

But I face one issue, I register and login customer successfully, but after receiving ajax response I refresh browser page, and I found customer is not logged in. I have checked customer status right before $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response)); and I verified customer logged in. but some how browser refresh is not showing customer is logged in.

I tried above code in fresh Magento 1.9.2.4 with sample data and with cache disabled. I face same issue.

I think issue is with session instance. To find out session validation, when I put form_key input in my forms and trying to validate, it fails. key value change in my controller action.

My form html input form_key : <input name="form_key" type="hidden" value="B6cegiWPPdruA83H">

and I am verifying it using this in controller action method: Mage::log(Mage::getSingleton('core/session')->getFormKey(), null, "popups.log", true); I found value is different here: bH60GsLwgJHT6gyC

I tried above method to verify session instance, I am not sure why it changes on for ajax requests.

so I think session is not persistent, I log in customer in session, and when I refresh browser page, May be new session is created and I lost customer login.

registered customer with my custom forms, can login with normal Magento login form.

can somebody please help me with this ? I am sure I am missing something, but not sure about that. I can post controller methods which I use to register and login customer.

2

Mukund,there are few reason,this issue rasied

like:

Cookie Domain and other cookie related setting is not proper that why it is create issue.So you need to fix it.

  1. Cookie Path: /
  2. Cookie Domain: .site.com

Most of cases, i have see that is cookie setting issue.

Or,other way,you can check it is cookie setting or not. Delete all cookie records from core_config_data

delete from core_config_data where path like "%cookie%".

Other case,you Accountroller predispatch event may be create issue. For that case,you can follow this question AccountController override not working on new Action and doing 302 redirection

  • Thanks Amit, I found your suggested link helpful, actually I got my controller working by applying @Marius solution : magento.stackexchange.com/a/76697/2401, I was extending Mage_Customer_AccountController controller, I just stopped and using Mage_Core_Controller_Front_Action and I copied all my required methods to my custom controller. and all resolved. Still I don't understand why that solution worked. but it is. this solution is also validates session form_key. So, Thanks for your time and help. I also learned proper way to send response from your links. – Mukund Thanki Jun 20 '16 at 6:19

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.