6

customer login don't works with Safari, only if i activate incognito mode in Safari.

After click on login, page reload itself without error massage.

I have take:

  • Clear Cookies in Safari
  • Clear var/cache & var/sessions
  • Insert formkey in login template
  • Remove Cookie params in Varien.php

Using Magento 1.9

The Magento shop works fine in months, this problem appeared last week without any changes at shop.

If i clear var/sessions and clear Cookies in safari i can login, but only one time. If i log out and try a new log in, do not work.

Update: I have found a solution

All possible ways are not fix the login problem at my shop, this one works:

Go to:

app/code/core/Mage/Customer/Model/Session.php

Around line: 224

Comment out:

$this->renewSession();

    public function setCustomerAsLoggedIn($customer)
{
    $this->setCustomer($customer);
//  $this->renewSession();
    Mage::dispatchEvent('customer_login', array('customer'=>$customer));
    return $this;
}

Better Solution without works on core files::

  1. Backup your databases (you should always do this before making any modifications).
  2. Build the following directory hierarchy: app/code/local/Mage/Customer/Model/.
  3. Put a copy of session.php into this new directory.
  4. Comment out the appropriate line, shown above, and save your file.

Found here: http://www.novusweb.com/fix-for-passing-magento-session-ids/

  • We have this issue too – snh_nl Apr 3 '15 at 5:56
  • is umcommenting // $this->renewSession(); really the solution? – snh_nl Apr 3 '15 at 12:43
6

Make sure to setup your cookie domain name exactly same as how you access from browser(with or without www) And check the following settings in

Magento admin under System > Config > Web

And update like following

Cookie Lifetime: 33600
Cookie Path: /
Cookie Domain: www.yourdomainname.com
Use HTTP Only: No
Cookie Restriction Mode: No

This should fix your problem(Clear your browser cookie for one last time and check)

If this doesn't work still your server environment and session/cookie saving doesn'tmatch like magento needed. So you may need to un-comment domain settings in

app/code/core/Mage/Core/Model/Session/Abstract/Varien.php

Around #95 from

        // session cookie params
        $cookieParams = array(
            'lifetime' => $cookie->getLifetime(),
            'path'     => $cookie->getPath(),
            'domain'   => $cookie->getConfigDomain(),
            'secure'   => $cookie->isSecure(),
            'httponly' => $cookie->getHttponly()
        );

To

   // session cookie params
    $cookieParams = array(
        'lifetime' => $cookie->getLifetime(),
        'path'     => $cookie->getPath(),
        // 'domain'   => $cookie->getConfigDomain(),
        // 'secure'   => $cookie->isSecure(),
        // 'httponly' => $cookie->getHttponly()
    );

Note:

You can extend this core file to your local and do this and you need to uncomment only the domain,secure,http params not entire cookie params.

  • 1
    I have check both solutions, but this do not solved this problem. – ManuHH Dec 23 '14 at 12:10
  • Leaving the Cookie Domain empty has always worked -- this sounds as a bug – snh_nl Apr 3 '15 at 12:43
  • This worked for me on a website using magento 1.7.0.1 – Vassilis Barzokas Aug 21 '15 at 7:52
4

Go to:

app/code/core/Mage/Customer/Model/Session.php

Comment out:

$this->renewSession();

Like,

public function setCustomerAsLoggedIn($customer)  
{

    $this->setCustomer($customer); 
    // $this->renewSession();
    Mage::dispatchEvent('customer_login', array('customer'=>$customer));
    return $this;   
}
  • This must be a bug as this is the only thing that worked – Joel Davey Sep 1 '15 at 9:32
  • This is the answer! – Joe Oct 28 '15 at 17:32
  • Is the renew session maybe where the cookie goes wrong? (As hard coding the domain also worked in our case) – snh_nl Feb 29 '16 at 13:13
  • This worked for me, but doesnt this make stale cookies? Did anybody have any issues after doing this? – Kalvin Klien Mar 18 '16 at 18:42
3

We solved this by editing Magento admin under System > Config > Web and force set Cookie Domain

Cookie Domain being empty has always worked for us ... and it works on mosst browsers. Just not on Safari (ipad/Mac/iphone) ... Don't know why ...

But the issue was fixed using above

3

For anyone still stuck on this issue, I resolved this for myself using following settings

In : System > Config > Web

Cookie Lifetime: 86400
Cookie Path:
Cookie Domain:
Use HTTP Only: YES
Cookie Restriction Mode: no

Important settings is HTTP Only: YES

Rest of the settings will be default settings. This should work.

I tried all the other options in SO, but they didnt help me, so if anyone else is on same boat maybe try this.

2

I see all of these solution to this issue that never fixed my issue, some persons spoke about form key, my pages already had the form key inserted, some persons spoke about edited the sessions functions.

All that was the problem was that the time zone wasn't set to the right time zone in magento.

Check your time zone in your magento configuration and set to your server time zone which should fix the issue. As this fixed mine.

2

I've managed to fix this by setting the Cookie Lifetime to 0 under General > Web > Session Cookie Management.

 Cookie Path: 0
 Cookie Path: /
 Cookie Domain:  
 Use HTTP Only: No
 Cookie Restriction Mode: No

and updating the app/code/core/Mage/Customer/Model/Session.php

public function setCustomerAsLoggedIn($customer)  
{

    $this->setCustomer($customer); 
    // $this->renewSession();
    Mage::dispatchEvent('customer_login', array('customer'=>$customer));
    return $this;   
}

However, this fix requires current customers to clear their existing cookies.

1

I have same problem with logging in safari - I have tried all the above ALL of them break the ability to log in from other browsers other than safari which obviously I cant use. The only one that fixes the problem in Safari (but breaks in all other browsers) is setting the Use HTTP Only Setting.

1

Before touching and modifying magento core try to go to the System->Configuration in your admin panel, then under General->Web edit your Cookie path and Cookie Domain to yours and it should work fine

0

Cookie Lifetime: 86400 Cookie Path: Cookie Domain: Use HTTP Only: YES Cookie Restriction Mode: no

worked for me.

I used to have following setup

Cookie Path: 0 Cookie Path: / Cookie Domain: Use HTTP Only: No Cookie Restriction Mode: No

But every time i try to update product information or if i try to update or add product picture from backend i logout automatically. So for me the first setup worked. No more issue. I will post if i find any more issue.

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.