Magento Forum

Page 1 of 3
Remember me box on login page
 
Netismine
Sr. Member
 
Avatar
Total Posts:  174
Joined:  2008-10-28
 

I was really surprised it doesn’t exist smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
plamenski
Member
 
Total Posts:  35
Joined:  2009-01-04
 

We do need this feature for returning customers.
An extension would be more than appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
spoonhonda
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-02-15
Albany, Oregon, USA and Monterrey, NL, Mexico
 

Yes, I also would very much like to see this feature made available for Magento.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdeckert
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2009-05-07
Waterloo, Ontario, Canada
 

I work with a company that will probably develop this if there is more interest. Get some more chat on this topic and I can convince the boss to develop it!

 
Magento Community Magento Community
Magento Community
Magento Community
 
spoonhonda
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-02-15
Albany, Oregon, USA and Monterrey, NL, Mexico
 

Steve, I like the sound of that!  Tell your boss you have at least someone (me) willing to pay for this extension if you guys publish it.
Seems like when I am logged into the front it logs me out after 10 min.  It’s really annoying to have to keep logging back on all the time

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdeckert
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2009-05-07
Waterloo, Ontario, Canada
 

To spoonhonda:

Well there is a solution that is much easier (and much less expensive!) than an extension for that purpose. Simply change the cookie lifetime settings.

System>Configuration>Web (its on the left side-bar)>Session Cookie Management>Cookie Lifetime

I believe the default value is 3600 (seconds). Increasing this increases the time required for inactivity timeout.

To others:
I’ll have the “remember me” extension done really soon. For free. wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
spoonhonda
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-02-15
Albany, Oregon, USA and Monterrey, NL, Mexico
 

Steve,
Wow, you’re going to do that for fee!  I was expecting to have to pay for it or something.  I just wish I know a little more about MySQL and PHP to do this type of thing myself.  But, I am learning.  Until then you’re my hero! 

Also, thanks for the tip on changing the cookie lifetime.  I had not actually noticed that setting before.  I was adjusting the setting in:
System>Configuration>Magento Core Api “Client Session timeout (sec.)”
System>Configuration>Admin> Security “Session Lifetime, Seconds”

I was thinking one of those two settings had to do with the frontend user session inactive timeout cookie.  I was thinking maybe I was simply misperceiving time or something when things seemed to not change. “Follow the white rabbit” lol

 
Magento Community Magento Community
Magento Community
Magento Community
 
NemanjaS
Jr. Member
 
Total Posts:  2
Joined:  2009-05-11
Serbia/Belgrade
 

Ok, my company ask me to create this for our purposes so here it is:

edit:

customer/form/login.phtml

and add where ever your checkbox want it to be.

<input type="checkbox" name="rememberme" value="remember"Remember me.<br>

next edit

app/code/core/Mage/Core/etc/System.xml

after

<cookie_httponly translate="label">
                            <
label>Use HTTP Only</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>adminhtml/system_config_source_yesno</source_model>
                            <
sort_order>40</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
cookie_httponly>
                    </
fields>
                </
cookie>

add

<cookie2 translate="label">
                    <
label>Session Cookie User management</label>
                    <
frontend_type>text</frontend_type>
                    <
sort_order>51</sort_order>
                    <
show_in_default>1</show_in_default>
                    <
show_in_website>1</show_in_website>
                    <
show_in_store>1</show_in_store>
                    <
fields>
                        <
cookie_lifetime2 translate="label">
                            <
label>Cookie Lifetime</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>30</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
cookie_lifetime2>
                       
                    </
fields>
                </
cookie2>

Now we have options in our admin section to set cookie lifetime for users

Next thing is to edit

app/code/core/Mage/Core/Model/Cookie.php

after

onst XML_PATH_COOKIE_HTTPONLY  'web/cookie/cookie_httponly';
add
const XML_PATH_COOKIE_LIFETIME_LONG  'web/cookie2/cookie_lifetime2';

and this

public function getLifetime()
    
{
        $lifetime 
Mage::getStoreConfig(self::XML_PATH_COOKIE_LIFETIME$this->getStore());
        if (!
is_numeric($lifetime)) {
            $lifetime 
3600;
        
}
        
return $lifetime;
    
}

change with

public function getLifetime()
    
{
    
if (isset($_REQUEST['rememberme'])){
    $lifetime 
Mage::getStoreConfig(self::XML_PATH_COOKIE_LIFETIME_LONG$this->getStore());
    return 
$lifetime;
    
}else{
        
if (null !== $this->_lifetime{
            $lifetime 
$this->_lifetime;
        
}
        
else {
            $lifetime 
Mage::getStoreConfig(self::XML_PATH_COOKIE_LIFETIME$this->getStore());
        
}
        
if (!is_numeric($lifetime)) {
            $lifetime 
3600;
        
}
        
return $lifetime;
    
}
    }

And that should be it.

Any suggestions or corrections are welcome.

 
Magento Community Magento Community
Magento Community
Magento Community
 
spoonhonda
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-02-15
Albany, Oregon, USA and Monterrey, NL, Mexico
 

Cool!!  I am going to test it out today.  I’ll let you know how it goes.  Thanks so much or doing this.

 
Magento Community Magento Community
Magento Community
Magento Community
 
spoonhonda
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-02-15
Albany, Oregon, USA and Monterrey, NL, Mexico
 

Woops lol *duplicate post deleted*

 
Magento Community Magento Community
Magento Community
Magento Community
 
spoonhonda
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-02-15
Albany, Oregon, USA and Monterrey, NL, Mexico
 

I’ve updated NemanjaS post to hopefully make it a little more clear on how to do this, because I had a little trouble figuring out a couple of the steps.  For example, this first step was kind of confusing at first because I didn’t know where to find the login.phtml file.  I’ve edited the file path listed below so others don’t have the same problem finding it. 

edit:

app/design/frontend/blank/YourThemeName/template/customer/form/

This is the code I had to add in my login.phtml file to get it to worked with my template:

<div style="position:relative; top:140px; left:-3px; z-index:1; height:20px;"
<
input type="checkbox" name="rememberme" value="remember"Remember me.
</
div>

next edit

app/code/core/Mage/Core/etc/System.xml

after (this code is located close to the bottom of the file)

<cookie_httponly translate="label">
                            <
label>Use HTTP Only</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>adminhtml/system_config_source_yesno</source_model>
                            <
sort_order>40</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
cookie_httponly>
                    </
fields>
                </
cookie>

add

<cookie2 translate="label">
                    <
label>Session Cookie User Management</label>
                    <
frontend_type>text</frontend_type>
                    <
sort_order>51</sort_order>
                    <
show_in_default>1</show_in_default>
                    <
show_in_website>1</show_in_website>
                    <
show_in_store>1</show_in_store>
                    <
fields>
                        <
cookie_lifetime2 translate="label">
                            <
label>Cookie Lifetime</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>30</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
cookie_lifetime2>
                       
                    </
fields>
                </
cookie2>

Now we have options in our Admin Panel configuration section to set cookie lifetime for our frontend users that click the “Remember me” box.  You can find this setting if you login to your Admin Panel and navigate to:
System > Configuration > Web > Session Cookie User Management

Next thing is to edit

app/code/core/Mage/Core/Model/Cookie.php

after

onst XML_PATH_COOKIE_HTTPONLY  'web/cookie/cookie_httponly';
add
const XML_PATH_COOKIE_LIFETIME_LONG  'web/cookie2/cookie_lifetime2';

and this

public function getLifetime()
    
{
        $lifetime 
Mage::getStoreConfig(self::XML_PATH_COOKIE_LIFETIME$this->getStore());
        if (!
is_numeric($lifetime)) {
            $lifetime 
3600;
        
}
        
return $lifetime;
    
}

change with

public function getLifetime()
    
{
    
if (isset($_REQUEST['rememberme'])){
    $lifetime 
Mage::getStoreConfig(self::XML_PATH_COOKIE_LIFETIME_LONG$this->getStore());
    return 
$lifetime;
    
}else{
        
if (null !== $this->_lifetime{
            $lifetime 
$this->_lifetime;
        
}
        
else {
            $lifetime 
Mage::getStoreConfig(self::XML_PATH_COOKIE_LIFETIME$this->getStore());
        
}
        
if (!is_numeric($lifetime)) {
            $lifetime 
3600;
        
}
        
return $lifetime;
    
}
    }

A BIG thank you to NemanjaS!!! smile

Everything seems to work like it should for me.  Not sure if you guys (Steve and NemanjaS) work for the same boss/company but in any case thanks Steve for your efforts and for building interest in getting this thing rolling so fast.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdeckert
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2009-05-07
Waterloo, Ontario, Canada
 

Thanks for the work NemanjaS. Great code. I was developing an extension to do this job, to allow for future magento upgrades. I stopped once NemanjaS posted his solution. Is this worth me continuing the extension? Or is everyone happy with the solution? I just wanted to know so I don’t waste my time developing this.

 
Magento Community Magento Community
Magento Community
Magento Community
 
spoonhonda
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-02-15
Albany, Oregon, USA and Monterrey, NL, Mexico
 

Steve (and NemanjaS) I’ve been testing this and it is not working properly.  In the Admin Panel I have my “Session Cookie User Management” set to 7200 (2 hours), but it still logs me out after one hour of inactivity on the front end. 

So, I don’t know if it has to do with NemanjaS code or something else with the Magento’s core code.  I hope you guys don’t stop working with this just yet. 

Again thanks a lot for all the hard work!

 
Magento Community Magento Community
Magento Community
Magento Community
 
spoonhonda
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-02-15
Albany, Oregon, USA and Monterrey, NL, Mexico
 

After manually deleting my IE7 and Firefox cookie files I ran 3 other tests since that last post of mine, and I am still having the same problem with me getting logged out after one hour of inactivity.

Is anyone else having the same problem?

Here is the locations of the cookie files in my Vista 32bit install:

C:Users\Dave\AppData\Local\Microsoft\Windows\Temporary Internet Files\Cookie:dave@spoonertuner.com
C
:Users\Dave\AppData\Local\Microsoft\Windows\Cookies\dave@spoonertuner[1].txt

This is my first cookie created before I loggin on the front end:
frontend
ba9b989220213abedfb0fa973cf8424e
spoonertuner.com/
9728
3890896256
30004614
3205686256
30004614
*
__utma
214461141.1145108483968304100.1242410311.1242410311.1242410311.1
spoonertuner.com/
1600
2998511360
30151465
3249906256
30004614
*
__utmb
214461141.1.10.1242410311
spoonertuner.com/
1600
4061027072
30004618
3249946256
30004614
*
__utmz
214461141.1242410311.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
spoonertuner.com/
1600
2106558208
30041327
3249346256
30004614
*

This is the cookie after I logged in on the frontend
frontend
ba9b989220213abedfb0fa973cf8424e
spoonertuner.com/
9728
3706452224
30004631
386838960
30004615
*
__utma
214461141.1145108483968304100.1242410311.1242410311.1242410311.1
spoonertuner.com/
1600
173544064
30151466
418058960
30004615
*
__utmb
214461141.3.10.1242410311
spoonertuner.com/
1600
1236059776
30004619
418508960
30004615
*
__utmz
214461141.1242410311.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
spoonertuner.com/
1600
2106558208
30041327
3249346256
30004614
*

 
Magento Community Magento Community
Magento Community
Magento Community
 
miked2004
Sr. Member
 
Avatar
Total Posts:  214
Joined:  2007-12-13
Atlanta, Georgia
 

I have taken the code provided here and put it into a folder structure that will not force you to modify core code. Here is the tutorial to do this.

 
Magento Community Magento Community
Magento Community
Magento Community
 
spoonhonda
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-02-15
Albany, Oregon, USA and Monterrey, NL, Mexico
 

Hey, wow, that is great Mike!  I hope your code is the solution the problem.  I will test it out tomorrow and let you know how it goes.  At any rate, I am very grateful for your efforts, and happy to hear your solution does not modify the core code. Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3