Zen Cart Logo
Forums / All Other Contributions/Addons / Is a Permanent Login (Auto-Login) Possible?

Is a Permanent Login (Auto-Login) Possible?

Views: 54,355

Results 101 to 120 of 219
11 Feb 2016, 1:01 AM
#101
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

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?

12 Feb 2016, 6:59 PM
#102
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

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.

13 Feb 2016, 12:17 AM
#103
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

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:

$_SESSION['customer_remembered'] = true;

Insert this:

if(!$_SESSION['cart']) $_SESSION['cart'] = new shoppingCart(); 
$_SESSION['cart']->restore_contents(); 
13 Feb 2016, 12:31 AM
#104
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

Re: Is a Permanent Login (Auto-Login) Possible?

On second thought, I'm a bit concerned about this line....

 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.... :/

13 Feb 2016, 1:42 PM
#105
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

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:

if (![B]isset[/B] ($_SESSION['cart'])[B])[/B] {
     $_SESSION['cart'] = new shoppingCart(); 
}
$_SESSION['cart']->restore_contents();
2 Mar 2016, 12:29 AM
#106
hairydog avatar

hairydog

Zen Follower

Join Date:
Sep 2006
Posts:
165
Plugin Contributions:
0

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.

2 Mar 2016, 12:31 PM
#107
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Is a Permanent Login (Auto-Login) Possible?

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.

2 Mar 2016, 2:30 PM
#108
hairydog avatar

hairydog

Zen Follower

Join Date:
Sep 2006
Posts:
165
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

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.

19 Aug 2016, 2:40 AM
#109
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

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:

          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:

          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...

19 Aug 2016, 10:03 AM
#110
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

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.

19 Aug 2016, 11:46 PM
#111
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

Re: Is a Permanent Login (Auto-Login) Possible?

Hi lat9!

Yes, exactly. I'm not sure why I thought my little one line of code would actually make this work.

Turns out my testing was completely botched by the fact that I was testing isset on $_SESSION['emp_admin_login'] rather than testing whether $_SESSION['emp_admin_login'] = true...

Wow...anyhow...

Here's what I did to solve the issue:

Below:

$customers_hashed_password = (isset ($remember_info['password'])) ? $remember_info['password'] : '~~~~';

Put:

$emp = (isset ($remember_info['emp'])) ? $remember_info['emp'] : false;

Then Below:

$_SESSION['customer_zone_id'] = $check_country->fields['entry_zone_id'];

Put:

$_SESSION['emp_admin_login'] = $emp;

Also, as per my previous change, it should remain intact:

After:

'password' => md5 ($this->secret . $password_info->fields['customers_password'])

Add:

, 'emp' => $_SESSION['emp_admin_login']

(including the comma for anyone unfamiliar of what's going on there)

So that it looks like:

'password' => md5 ($this->secret . $password_info->fields['customers_password']), 'emp' => $_SESSION['emp_admin_login'] );

Based on a previous post with a different issue (the shopping cart restore) - we need to test if $_SESSION['emp_admin_login'] isset to avoid php errors...

So I've done this (need advice here):

Below:

$password_info = $db->Execute ("SELECT customers_password FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . $_SESSION['customer_id'] . "'");

Put:

if(!isset($_SESSION['emp_admin_login']))
{
$_SESSION['emp_admin_login'] = false;
}
19 Aug 2016, 11:55 PM
#112
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

Re: Is a Permanent Login (Auto-Login) Possible?

The part to avoid php errors is completely nullifying the remember me and you end up being logged out completely, don't know what I'm doing wrong there. The rest works just fine though...

So did this,

Change:

'emp' => $_SESSION['emp_admin_login']

To:

'emp' => (isset ($_SESSION['emp_admin_login'])) ? $_SESSION['emp_admin_login'] : false

And remove this completely:

if(!isset($_SESSION['emp_admin_login']))
{
$_SESSION['emp_admin_login'] = false;
} 
4 Jul 2017, 4:53 AM
#113
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

So I use log in as customer, and I want to have the header of that add-on force this add-on to delete the cookie or session data? so that it forces the new log-in information to take effect... but I don't know how to do this.

Right now as it is, if I log in as a customer, and I have a previous log-in remembered, the remembered log-in stays in effect, and the customer's account does not log-in because the previous one is still logged in.

Any suggestions?

4 Jul 2017, 10:23 AM
#114
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

Re: Is a Permanent Login (Auto-Login) Possible?

wolfderby:

So I use log in as customer, and I want to have the header of that add-on force this add-on to delete the cookie or session data? so that it forces the new log-in information to take effect... but I don't know how to do this.

Right now as it is, if I log in as a customer, and I have a previous log-in remembered, the remembered log-in stays in effect, and the customer's account does not log-in because the previous one is still logged in.

Any suggestions?

You would have to initiae the logoff procedure. I'm not too sure, but I believe there's a notifier hook to initiate the logoff procedure with the Automatic Login. If I'm not mistaken, you could trigger the hook somewhere in the Log in as customer header. Are you familiar with coding?

4 Jul 2017, 12:15 PM
#115
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Is a Permanent Login (Auto-Login) Possible?

yaseent:

You would have to initiae the logoff procedure. I'm not too sure, but I believe there's a notifier hook to initiate the logoff procedure with the Automatic Login. If I'm not mistaken, you could trigger the hook somewhere in the Log in as customer header. Are you familiar with coding?
Spot on, @yaseent! The Automatic Login plugin "expires" any cookie associated with the current login session upon logoff, whether that's a normal customer login, a Log In as Customer login or an Encrypted Master Password login.

@wolfderby, if you simply add to your "login as customer" procedure to ensure that you logoff after processing that customer-related action, then the "remembered" password will be removed so that you can then log in as a different customer.

16 Oct 2017, 9:30 PM
#116
solo_400 avatar

solo_400

Zen Follower

Join Date:
Aug 2009
Posts:
369
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

I really wish that "remember me?" checkbox to be checked by default. How to do that ?

16 Oct 2017, 9:39 PM
#117
solo_400 avatar

solo_400

Zen Follower

Join Date:
Aug 2009
Posts:
369
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

I can see now in my browser settings 10 zcrm_samehash cookies for every category page. Is that normal ?

17 Oct 2017, 10:13 AM
#118
solo_400 avatar

solo_400

Zen Follower

Join Date:
Aug 2009
Posts:
369
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

This module doesn't work. I have zcrm_xxx cookies expire in 2018 but I'm not logged into my account. No error logs. Can you give me some advise where should I look for ? I really like this module and I think is helpful.

thx

17 Oct 2017, 11:37 AM
#119
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Is a Permanent Login (Auto-Login) Possible?

solo_400:

This module doesn't work. I have zcrm_xxx cookies expire in 2018 but I'm not logged into my account. No error logs. Can you give me some advise where should I look for ? I really like this module and I think is helpful.

thx
A link to the site? What version of Zen Cart? What version of PHP?

17 Oct 2017, 11:53 AM
#120
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Is a Permanent Login (Auto-Login) Possible?

lat9:

A link to the site? What version of Zen Cart? What version of PHP?
FWIW, I just installed v1.4.2 of "Remember Me" on a fresh ZC 1.5.5e site using the responsive classic template without issue.