clockworkgeek / magento-remember-me Goto Github PK
View Code? Open in Web Editor NEWAdds a "remember me" option to Magento login forms.
Home Page: http://www.magentocommerce.com/magento-connect/remember-me.html
Adds a "remember me" option to Magento login forms.
Home Page: http://www.magentocommerce.com/magento-connect/remember-me.html
Thanks for the great extension!
I'm having an issue with the cookies expiring before they should. I've verified that the 'frontend' cookie has an expiration date 1 year in the future but, regardless, the cookies are still expiring. This happens on a myriad of different devices/browsers so I don't think it's an issue with browser settings. I'm using Magento EE 1.9.1.1.
php_value session.gc_maxlifetime 2592000
in the site's .htaccess
file.After doing the above, I modified the Cookie.php file provided in the extension to include some logging functionality so we can see what is going on.
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
*
* @category Customer
* @package Clockworkgeek_Rememberme
* @author Daniel Deady <[email protected]>
* @copyright Copyright (c) 2010, Daniel Deady
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
class Clockworkgeek_Rememberme_Model_Cookie extends Mage_Core_Model_Cookie
{
/**
* Set cookie
* Override period if asked to
*
* @param string $name The cookie name
* @param string $value The cookie value
* @param int $period Lifetime period
* @param string $path
* @param string $domain
* @param int|bool $secure
* @return Mage_Core_Model_Cookie
*/
public function set($name, $value, $period = null, $path = null, $domain = null, $secure = null, $httponly = null)
{
if (is_null($period)) {
Mage::log('Setting cookie ' . $name . ':');
Mage::log("set($name, $value, $period, $path, $domain, $secure, $httponly)");
// use $_SESSION directly as session classes may not be initialised yet
$session = ( isset($_SESSION['rememberme']) ? (bool)$_SESSION['rememberme'] : false );
$login = Mage::app()->getRequest()->getPost('login');
$rememberme = ( isset($login['rememberme']) ? (bool)$login['rememberme'] : false );
$period = $session || $rememberme; // true = one year
}
Mage::log("parent::set($name, $value, $period, $path, $domain, $secure, $httponly)");
return parent::set($name, $value, $period, $path, $domain, $secure, $httponly);
}
/**
* Add our flag on login
*/
public function setSessionRemembrance()
{
if (isset($_SESSION) && !isset($_SESSION['rememberme'])) {
$login = Mage::app()->getRequest()->getPost('login');
$_SESSION['rememberme'] = isset($login['rememberme']) && $login['rememberme'];
Mage::log('setSessionRemembrance() --> $_SESSION[rememberme] = ' . $_SESSION['rememberme']);
}
}
/**
* Remove our flag on logout
*/
public function unsetSessionRemembrance()
{
Mage::log('unsetSessionRemembrance()');
if (isset($_SESSION['rememberme'])) unset($_SESSION['rememberme']);
}
}
I then ran a couple of different scenarios. The log output is below:
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
setSessionRemembrance() --> $_SESSION[rememberme] =
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
unsetSessionRemembrance()
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, 1, , , , )
setSessionRemembrance() --> $_SESSION[rememberme] = 1
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, 1, , , , )
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, 1, , , , )
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, 1, , , , )
unsetSessionRemembrance()
Setting cookie frontend:
set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
parent::set(frontend, 0r3kd363akl2b49smcja14peh2, , , , , )
It appears the set() function is being called multiple times when logging in and logging out. Is this normal? After looking at the logs above, do you see any issue with the way the extension is behaving?
Do I need to modify any of the settings for session cookie management within the admin panel at System -> Configuration -> Web -> Session Cookie Management?
Thanks again for the extension!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.