Re: Is a Permanent Login (Auto-Login) Possible?
Hey Lat9,
thanks for the awesome plugin.
I've given it a go on a 1.5.4 installation.
I decided to login, add a product to cart, and then go to home page.
I then left the test site completely alone for 24 minutes just to test it out.
After the 24 minute period, I click on a random product that is shown on the home page under the Whats New products...
It stays logged in, but the cart contents are emptied. I tested this several times, each time doing the same thing, not always clicking on a random product, simply reloading the page does the same thing.
I then tested out logging out and logging back in. The cart contents are actually restored when doing this. So it doesn't forget the cart contents, it just empties it for that session after inactivity until you log out and log back in. Any ideas?
Re: Is a Permanent Login (Auto-Login) Possible?
@yaseent: I've opened an issue in the plugin's GitHub repo (https://github.com/lat9/remember_me/issues/4) to track the issue that you reported.
Re: Is a Permanent Login (Auto-Login) Possible?
I found a solution that fixes the issue:
Open includes/classes/observers/class.remember_me_observer.php
Beneath this line:
PHP Code:
$_SESSION['customer_remembered'] = true;
Insert this:
PHP Code:
if(!$_SESSION['cart']) $_SESSION['cart'] = new shoppingCart();
$_SESSION['cart']->restore_contents();
Re: Is a Permanent Login (Auto-Login) Possible?
On second thought, I'm a bit concerned about this line....
PHP Code:
if(!$_SESSION['cart']) $_SESSION['cart'] = new shoppingCart();
I found this placed twice in Zen Carts original core files...but in both instances it's commented out...So it does the job, but whether it should be used...I don't know...can anyone shed light.... :/
Re: Is a Permanent Login (Auto-Login) Possible?
The "remember me" processing is loaded at autoload check-point #71; the cart is instantiated (if not already present) at #80 using a process very similar (it does a whole lot more) to the code you posted (that I'm going to graciously include in the plugin's next update).
I'm going to change the code you posted just a bit prior to use, to reduce the chance of receiving a PHP warning if that session-variable is not set:
Code:
if (!isset ($_SESSION['cart'])) {
$_SESSION['cart'] = new shoppingCart();
}
$_SESSION['cart']->restore_contents();
Re: Is a Permanent Login (Auto-Login) Possible?
This plugin is exactly what I was looking for, but I'm having real difficulties with it on ZC 1.3.9h. It seemed to be working, but it has a few major issues:
1. If you put something in your basket when logged out then try to log in, you get a "security error" message and can't log in till you empty your basket.
2. If you put something in your basket in a session, then log out, you are logged out. But as soon as you go to the page of the thing you previously put into the basket, you are magically logged in again.
3. With this plugin installed, when you log in, you don't get the "merged your visitor's cart" message at all.
I think there is something wrong with the code that merges the baskets. Is this because I'm using a 1.5.x plugin on a 1.3.9h site? If so, I'll have to wait till 1.5.5 is complete: they plan to move to that when it is released.
Re: Is a Permanent Login (Auto-Login) Possible?
Quote:
Originally Posted by
hairydog
This plugin is exactly what I was looking for, but I'm having real difficulties with it on ZC 1.3.9h. ... Is this because I'm using a 1.5.x plugin on a 1.3.9h site? If so, I'll have to wait till 1.5.5 is complete: they plan to move to that when it is released.
The plugin, itself, is pretty non-intrusive ... making only a couple of template-related changes to the login/create-account form. It could be that the Zen Cart login/logoff handling and notification system has changed subtly over the past 6 or so years.
Re: Is a Permanent Login (Auto-Login) Possible?
Quote:
Originally Posted by
lat9
The plugin, itself, is pretty non-intrusive ... making only a couple of template-related changes to the login/create-account form. It could be that the Zen Cart login/logoff handling and notification system has changed subtly over the past 6 or so years.
I think you are right. It works just fine on the 1.5.4 sites I've installed it on. I think I'll have to leave it till we move the 1.3.9 sites to 1.5.5 which will hopefully be released for production soon.
Re: Is a Permanent Login (Auto-Login) Possible?
Hi lat9,
I've become interested in getting this plugin to remember if I was logged in using Encrypted Master Password, and act accordingly...
Basically what I've done is changed this:
PHP Code:
if (!$password_info->EOF) {
$remember_me_info = array ( 'id' => $_SESSION['customer_id'],
'password' => md5 ($this->secret . $password_info->fields['customers_password']) );
$cookie_value = base64_encode (gzcompress (serialize ($remember_me_info), 9));
setcookie ($this->cookie_name, $cookie_value, time() + $this->cookie_lifetime);
}
to this:
PHP Code:
if (!$password_info->EOF) {
$remember_me_info = array ( 'id' => $_SESSION['customer_id'],
'password' => md5 ($this->secret . $password_info->fields['customers_password']),
'emp' => $_SESSION['emp_admin_login'] );
$cookie_value = base64_encode (gzcompress (serialize ($remember_me_info), 9));
setcookie ($this->cookie_name, $cookie_value, time() + $this->cookie_lifetime);
}
So I've added in this: 'emp' => $_SESSION['emp_admin_login']
into $remember_me_info array...
It seems to be giving me the desired result.
So if I've logged into a customer account with EMP, and the session times out....When the cookie logs me back in it triggers the $_SESSION['emp_admin_login'] flag...
Just wondering if I could be missing anything...
Re: Is a Permanent Login (Auto-Login) Possible?
Nice integration idea, yaseent! I've reviewed your changes and the remember-me plugin's current code and I'm not clear as to how your change is working.
I'll review further over the next couple of days and give you more "proper" feedback.