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:
PHP Code:
$customers_hashed_password = (isset ($remember_info['password'])) ? $remember_info['password'] : '~~~~';
Put:
PHP Code:
$emp = (isset ($remember_info['emp'])) ? $remember_info['emp'] : false;
Then Below:
PHP Code:
$_SESSION['customer_zone_id'] = $check_country->fields['entry_zone_id'];
Put:
PHP Code:
$_SESSION['emp_admin_login'] = $emp;
Also, as per my previous change, it should remain intact:
After:
PHP Code:
'password' => md5 ($this->secret . $password_info->fields['customers_password'])
Add:
PHP Code:
, 'emp' => $_SESSION['emp_admin_login']
(including the comma for anyone unfamiliar of what's going on there)
So that it looks like:
PHP Code:
'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:
PHP Code:
$password_info = $db->Execute ("SELECT customers_password FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . $_SESSION['customer_id'] . "'");
Put:
PHP Code:
if(!isset($_SESSION['emp_admin_login']))
{
$_SESSION['emp_admin_login'] = false;
}
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:
PHP Code:
'emp' => $_SESSION['emp_admin_login']
To:
PHP Code:
'emp' => (isset ($_SESSION['emp_admin_login'])) ? $_SESSION['emp_admin_login'] : false
And remove this completely:
PHP Code:
if(!isset($_SESSION['emp_admin_login']))
{
$_SESSION['emp_admin_login'] = false;
}
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?
Re: Is a Permanent Login (Auto-Login) Possible?
Quote:
Originally Posted by
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?
Re: Is a Permanent Login (Auto-Login) Possible?
Quote:
Originally Posted by
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.
Re: Is a Permanent Login (Auto-Login) Possible?
I really wish that "remember me?" checkbox to be checked by default. How to do that ?
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 ?
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
Re: Is a Permanent Login (Auto-Login) Possible?
Quote:
Originally Posted by
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?
Re: Is a Permanent Login (Auto-Login) Possible?
Quote:
Originally Posted by
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.