Clockworkgeek_Rememberme - Version 0.3.0

Version Notes

Now packaged for Connect 2.0.

If using a custom theme that modifies the login template please pay attention to "design/frontend/base/default/template/rememberme/form/" directory.

For translations see the "app/locale/en_US/Clockworkgeek_Rememberme.csv" file.

Download this release

Release Info

Developer Magento Core Team
Extension Clockworkgeek_Rememberme
Version 0.3.0
Comparing to
See all releases


Version 0.3.0

app/code/community/Clockworkgeek/Rememberme/Model/Cookie.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the Open Software License (OSL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://opensource.org/licenses/osl-3.0.php
9
+ *
10
+ *
11
+ * @category Customer
12
+ * @package Clockworkgeek_Rememberme
13
+ * @author Daniel Deady <daniel@clockworkgeek.com>
14
+ * @copyright Copyright (c) 2010, Daniel Deady
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Clockworkgeek_Rememberme_Model_Cookie extends Mage_Core_Model_Cookie
19
+ {
20
+
21
+ /**
22
+ * Set cookie
23
+ * Override period if asked to
24
+ *
25
+ * @param string $name The cookie name
26
+ * @param string $value The cookie value
27
+ * @param int $period Lifetime period
28
+ * @param string $path
29
+ * @param string $domain
30
+ * @param int|bool $secure
31
+ * @return Mage_Core_Model_Cookie
32
+ */
33
+ public function set($name, $value, $period = null, $path = null, $domain = null, $secure = null, $httponly = null)
34
+ {
35
+ if (is_null($period)) {
36
+ // use $_SESSION directly as session classes may not be initialised yet
37
+ $session = ( isset($_SESSION['rememberme']) ? (bool)$_SESSION['rememberme'] : false );
38
+ $login = Mage::app()->getRequest()->getPost('login');
39
+ $rememberme = ( isset($login['rememberme']) ? (bool)$login['rememberme'] : false );
40
+ $period = $session || $rememberme; // true = one year
41
+ }
42
+ return parent::set($name, $value, $period, $path, $domain, $secure, $httponly);
43
+ }
44
+
45
+ /**
46
+ * Add our flag on login
47
+ */
48
+ public function setSessionRemembrance()
49
+ {
50
+ if (isset($_SESSION) && !isset($_SESSION['rememberme'])) {
51
+ $login = Mage::app()->getRequest()->getPost('login');
52
+ $_SESSION['rememberme'] = isset($login['rememberme']) && $login['rememberme'];
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Remove our flag on logout
58
+ */
59
+ public function unsetSessionRemembrance()
60
+ {
61
+ if (isset($_SESSION['rememberme'])) unset($_SESSION['rememberme']);
62
+ }
63
+
64
+ }
65
+
app/code/community/Clockworkgeek/Rememberme/etc/config.xml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ *
12
+ * @category Customer
13
+ * @package Clockworkgeek_Rememberme
14
+ * @author Daniel Deady <daniel@clockworkgeek.com>
15
+ * @copyright Copyright (c) 2010, Daniel Deady
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Clockworkgeek_Rememberme>
22
+ <version>0.3</version>
23
+ </Clockworkgeek_Rememberme>
24
+ </modules>
25
+ <global>
26
+ <blocks>
27
+ </blocks>
28
+ <helpers>
29
+ </helpers>
30
+ <models>
31
+ <clockworkgeek_rememberme>
32
+ <class>Clockworkgeek_Rememberme_Model</class>
33
+ </clockworkgeek_rememberme>
34
+ <core>
35
+ <rewrite>
36
+ <cookie>Clockworkgeek_Rememberme_Model_Cookie</cookie>
37
+ </rewrite>
38
+ </core>
39
+ </models>
40
+ </global>
41
+ <frontend>
42
+ <layout>
43
+ <updates>
44
+ <rememberme>
45
+ <file>rememberme.xml</file>
46
+ </rememberme>
47
+ </updates>
48
+ </layout>
49
+ <events>
50
+ <customer_login>
51
+ <observers>
52
+ <clockworkgeek_rememberme>
53
+ <class>clockworkgeek_rememberme/cookie</class>
54
+ <method>setSessionRemembrance</method>
55
+ </clockworkgeek_rememberme>
56
+ </observers>
57
+ </customer_login>
58
+ <customer_logout>
59
+ <observers>
60
+ <clockworkgeek_rememberme>
61
+ <class>clockworkgeek_rememberme/cookie</class>
62
+ <method>unsetSessionRemembrance</method>
63
+ </clockworkgeek_rememberme>
64
+ </observers>
65
+ </customer_logout>
66
+ </events>
67
+ <translate>
68
+ <modules>
69
+ <Clockworkgeek_Rememberme>
70
+ <files>
71
+ <default>Clockworkgeek_Rememberme.csv</default>
72
+ </files>
73
+ </Clockworkgeek_Rememberme>
74
+ </modules>
75
+ </translate>
76
+ </frontend>
77
+ </config>
app/design/frontend/base/default/layout/rememberme.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout version="0.1.0">
3
+
4
+ <customer_logged_out>
5
+ <reference name="customer_form_mini_login">
6
+ <action method="setTemplate"><template>rememberme/form/mini.login.phtml</template></action>
7
+ </reference>
8
+ </customer_logged_out>
9
+
10
+ <customer_account_login>
11
+ <reference name="customer_form_login">
12
+ <action method="setTemplate"><template>rememberme/form/login.phtml</template></action>
13
+ </reference>
14
+ </customer_account_login>
15
+
16
+ </layout>
app/design/frontend/base/default/template/rememberme/form/login.phtml ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer login form template
30
+ *
31
+ * @see Mage_Customer_Block_Form_Login
32
+ */
33
+ ?>
34
+ <div class="account-login">
35
+ <div class="page-title">
36
+ <h1><?php echo $this->__('Login or Create an Account') ?></h1>
37
+ </div>
38
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
39
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
40
+ <div class="col2-set">
41
+ <div class="col-1 new-users">
42
+ <div class="content">
43
+ <h2><?php echo $this->__('New Customers') ?></h2>
44
+ <p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
45
+ </div>
46
+ </div>
47
+ <div class="col-2 registered-users">
48
+ <div class="content">
49
+ <h2><?php echo $this->__('Registered Customers') ?></h2>
50
+ <p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
51
+ <ul class="form-list">
52
+ <li>
53
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
54
+ <div class="input-box">
55
+ <input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
56
+ </div>
57
+ </li>
58
+ <li>
59
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
60
+ <div class="input-box">
61
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
62
+ </div>
63
+ </li>
64
+ <?php /* Begin rememberme customisation */ ?>
65
+ <li>
66
+ <div class="input-box">
67
+ <label for="rememberme" class="input-box"><input type="checkbox" name="login[rememberme]" class="checkbox left" id="rememberme" title="<?php echo $this->__('Remember me') ?>" style="margin-top: 2px" />
68
+ <?php echo $this->__('Remember me on this computer') ?></label>
69
+ </div>
70
+ </li>
71
+ <?php /* End rememberme customisation */ ?>
72
+ </ul>
73
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ <div class="col2-set">
78
+ <div class="col-1 new-users">
79
+ <div class="buttons-set">
80
+ <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo $this->getCreateAccountUrl() ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
81
+ </div>
82
+ </div>
83
+ <div class="col-2 registered-users">
84
+ <div class="buttons-set">
85
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
86
+ <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </form>
91
+ <script type="text/javascript">
92
+ //<![CDATA[
93
+ var dataForm = new VarienForm('login-form', true);
94
+ //]]>
95
+ </script>
96
+ </div>
app/design/frontend/base/default/template/rememberme/form/mini.login.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div class="block block-login">
28
+ <div class="block-title">
29
+ <strong><span><?php echo $this->__('Login') ?></span></strong>
30
+ </div>
31
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post">
32
+ <div class="block-content">
33
+ <label for="mini-login"><?php echo $this->__('Email:') ?></label><input type="text" name="login[username]" id="mini-login" class="input-text" />
34
+ <label for="mini-password"><?php echo $this->__('Password:') ?></label><input type="password" name="login[password]" id="mini-password" class="input-text" />
35
+ <?php /* Begin rememberme customisation */ ?>
36
+ <label for="mini-rememberme" class="input-box"><input type="checkbox" name="login[rememberme]" id="mini-rememberme" class="right" /> <?php echo $this->__('Remember me:') ?></label>
37
+ <?php /* End rememberme customisation */ ?>
38
+ <div class="actions">
39
+ <button type="submit" class="button"><span><span><?php echo $this->__('Login') ?></span></span></button>
40
+ </div>
41
+ </div>
42
+ </form>
43
+ </div>
app/etc/modules/Clockworkgeek_Rememberme.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ *
12
+ * @category Customer
13
+ * @package Clockworkgeek_Rememberme
14
+ * @author Daniel Deady <daniel@clockworkgeek.com>
15
+ * @copyright Copyright (c) 2010, Daniel Deady
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Clockworkgeek_Rememberme>
22
+ <active>true</active>
23
+ <codePool>community</codePool>
24
+ </Clockworkgeek_Rememberme>
25
+ </modules>
26
+ </config>
app/locale/en_US/Clockworkgeek_Rememberme.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ "Remember me","Remember me"
2
+ "Remember me:","Remember me:"
3
+ "Remember me on this computer","Remember me on this computer"
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Clockworkgeek_Rememberme</name>
4
+ <version>0.3.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Add a "remember me" option to login forms.</summary>
10
+ <description>Add a "remember me" option to login forms. Overrides default forms with those in "design/frontend/base/default/template/rememberme/form".</description>
11
+ <notes>Now packaged for Connect 2.0.&#xD;
12
+ &#xD;
13
+ If using a custom theme that modifies the login template please pay attention to "design/frontend/base/default/template/rememberme/form/" directory.&#xD;
14
+ &#xD;
15
+ For translations see the "app/locale/en_US/Clockworkgeek_Rememberme.csv" file.</notes>
16
+ <authors><author><name>clockworkgeek</name><user>auto-converted</user><email>nonproffessional@clockworkgeek.com</email></author></authors>
17
+ <date>2011-06-17</date>
18
+ <time>14:14:04</time>
19
+ <contents><target name="magecommunity"><dir name="Clockworkgeek"><dir name="Rememberme"><dir name="Model"><file name="Cookie.php" hash="9b292945fb1133b52c4b239b48fdebab"/></dir><dir name="etc"><file name="config.xml" hash="05b2e3c13a12e0703c7436251e0df063"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="rememberme.xml" hash="83a2e1ccffa0ab0fce4c1ad3831792f4"/></dir><dir name="template"><dir name="rememberme"><dir name="form"><file name="login.phtml" hash="28278218907cbddfe8d4a43d410e20d5"/><file name="mini.login.phtml" hash="9be6fe073f7298ac54bd6b8a8c1bffb2"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clockworkgeek_Rememberme.xml" hash="527fa1b6cafaa8c51284db22701526b8"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Clockworkgeek_Rememberme.csv" hash="5735e85f86d3e3a2face58296d113213"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies/>
22
+ </package>