Clockworkgeek_Rememberme - Version 0.5.2

Version Notes

Minor bug fixes

Download this release

Release Info

Developer Daniel Deady
Extension Clockworkgeek_Rememberme
Version 0.5.2
Comparing to
See all releases


Code changes from version 0.5.0 to 0.5.2

app/code/community/Clockworkgeek/Rememberme/Model/Cookie.php CHANGED
@@ -18,48 +18,28 @@
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
-
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 = (bool) @$_SESSION['rememberme'];
38
+ $login = Mage::app()->getRequest()->getPost('login');
39
+ $rememberme = (bool) @$login['rememberme'];
40
+ if ($session || $rememberme)
41
+ $period = true; // true = one year
42
+ }
43
+ return parent::set($name, $value, $period, $path, $domain, $secure, $httponly);
44
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
 
app/code/community/Clockworkgeek/Rememberme/Model/Observer.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2015, 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_Observer
19
+ {
20
+
21
+ /**
22
+ * Add our flag on login
23
+ */
24
+ public function setSessionRemembrance()
25
+ {
26
+ if (isset($_SESSION) && ! isset($_SESSION['rememberme'])) {
27
+ $login = Mage::app()->getRequest()->getPost('login');
28
+ $_SESSION['rememberme'] = (bool)@$login['rememberme'];
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Remove our flag on logout
34
+ */
35
+ public function unsetSessionRemembrance()
36
+ {
37
+ if (isset($_SESSION['rememberme'])) {
38
+ unset($_SESSION['rememberme']);
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Session is saved last, after page is output and sent.
44
+ * If saved in database then session has an individual expiry time.
45
+ */
46
+ public function setSessionExpiry()
47
+ {
48
+ if (isset($_SESSION['rememberme']) && $_SESSION['rememberme']) {
49
+ /* @var $store Mage_Core_Model_Store */
50
+ $store = Mage::app()->getStore();
51
+ if (! $store->isAdmin()) {
52
+ // session expiry is taken from cookie lifetime
53
+ $store->setConfig('web/cookie/cookie_lifetime', 60 * 60 * 24 * 365);
54
+ }
55
+ }
56
+ }
57
+ }
app/code/community/Clockworkgeek/Rememberme/etc/config.xml CHANGED
@@ -50,19 +50,31 @@
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>
50
  <customer_login>
51
  <observers>
52
  <clockworkgeek_rememberme>
53
+ <class>clockworkgeek_rememberme/observer</class>
54
  <method>setSessionRemembrance</method>
55
+ <type>singleton</type>
56
  </clockworkgeek_rememberme>
57
  </observers>
58
  </customer_login>
59
  <customer_logout>
60
  <observers>
61
  <clockworkgeek_rememberme>
62
+ <class>clockworkgeek_rememberme/observer</class>
63
  <method>unsetSessionRemembrance</method>
64
+ <type>singleton</type>
65
  </clockworkgeek_rememberme>
66
  </observers>
67
  </customer_logout>
68
+ <controller_front_send_response_after>
69
+ <!-- Last possible event -->
70
+ <observers>
71
+ <clockworkgeek_rememberme>
72
+ <class>clockworkgeek_rememberme/observer</class>
73
+ <method>setSessionExpiry</method>
74
+ <type>singleton</type>
75
+ </clockworkgeek_rememberme>
76
+ </observers>
77
+ </controller_front_send_response_after>
78
  </events>
79
  <translate>
80
  <modules>
app/design/frontend/rwd/default/template/rememberme/checkbox.phtml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /* @var $this Mage_Core_Block_Template */
18
+ ?>
19
+ <li class="control">
20
+ <div class="input-box">
21
+ <input type="checkbox" name="login[rememberme]" class="checkbox left" id="rememberme" title="<?php echo $this->__('Remember me') ?>" <?php if (Mage::getStoreConfigFlag('customer/rememberme/checked')) echo 'checked="checked"'; ?>/>
22
+ </div>
23
+ <label for="rememberme" style="width: auto;">
24
+ <?php echo $this->__('Remember me on this computer') ?>
25
+ </label>
26
+ <?php if (Mage::getStoreConfigFlag('customer/rememberme/warning')): ?>
27
+ <p><strong><?php echo $this->__('Caution!') ?></strong> <?php echo $this->__('Anyone using this computer might be able to access your account if you check this box.') ?></p>
28
+ <?php endif; ?>
29
+ </li>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Clockworkgeek_Rememberme</name>
4
- <version>0.5.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/".</description>
11
- <notes>Improved compatibility with all versions and Mage_Captcha and Mage_Persistent modules.</notes>
12
- <authors><author><name>clockworkgeek</name><user>nonproffessional</user><email>nonproffessional@clockworkgeek.com</email></author></authors>
13
- <date>2014-11-07</date>
14
- <time>17:19:37</time>
15
- <contents><target name="magecommunity"><dir name="Clockworkgeek"><dir name="Loginformfallback"><dir name="etc"><file name="config.xml" hash="2578ddb7451310a1b36ee2be2d9fa1c2"/></dir></dir><dir name="Rememberme"><dir name="Model"><file name="Cookie.php" hash="9b292945fb1133b52c4b239b48fdebab"/></dir><dir name="etc"><file name="config.xml" hash="d91aec4705b1f4e8d6b934568517aee2"/><file name="system.xml" hash="7302348f852d9db069e3336a9c7f20ee"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="loginformfallback.xml" hash="a948aeb2b7ba695ae3ec8d63436547f1"/><file name="rememberme.xml" hash="83de2ac36de0175757669cde33414982"/></dir><dir name="template"><dir name="loginformfallback"><dir name="checkout"><file name="login.phtml" hash="84561620d67b8019b4eb86db259b4148"/></dir><dir name="customer"><file name="login.phtml" hash="779575f37b9f49fff8868c8cab284ac1"/></dir></dir><dir name="rememberme"><file name="checkbox.phtml" hash="2d4eb0c8b5455e435162d73ac40ab5be"/><dir name="form"><file name="mini.login.phtml" hash="0b239b0ece858335fa0708304e027217"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clockworkgeek_Rememberme.xml" hash="4615cfb14e0d8f0296e8695e86bc7564"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Clockworkgeek_Rememberme.csv" hash="5346ff4284ea8a4a8f504d1668981e60"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Clockworkgeek_Rememberme</name>
4
+ <version>0.5.2</version>
5
  <stability>stable</stability>
6
+ <license>OSL-3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Adds a 'remember me' option to Magento login forms.</summary>
10
+ <description/>
11
+ <notes>Minor bug fixes</notes>
12
+ <authors><author><name>Daniel Deady</name><user>daniel</user><email>daniel@clockworkgeek.com</email></author></authors>
13
+ <date>2015-02-27</date>
14
+ <time>12:19:48</time>
15
+ <contents><target name="magecommunity"><dir name="Clockworkgeek"><dir name="Loginformfallback"><dir name="etc"><file name="config.xml" hash="2578ddb7451310a1b36ee2be2d9fa1c2"/></dir></dir><dir name="Rememberme"><dir name="Model"><file name="Cookie.php" hash="8b152ed23b84a40f54aaa8316b8ee542"/><file name="Observer.php" hash="63780becb3380f56850efe1aca0b768e"/></dir><dir name="etc"><file name="config.xml" hash="789e8fe29f723fc542778902d34e277c"/><file name="system.xml" hash="7302348f852d9db069e3336a9c7f20ee"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="loginformfallback.xml" hash="a948aeb2b7ba695ae3ec8d63436547f1"/><file name="rememberme.xml" hash="83de2ac36de0175757669cde33414982"/></dir><dir name="template"><dir name="loginformfallback"><dir name="checkout"><file name="login.phtml" hash="84561620d67b8019b4eb86db259b4148"/></dir><dir name="customer"><file name="login.phtml" hash="779575f37b9f49fff8868c8cab284ac1"/></dir></dir><dir name="rememberme"><file name="checkbox.phtml" hash="2d4eb0c8b5455e435162d73ac40ab5be"/><dir name="form"><file name="mini.login.phtml" hash="0b239b0ece858335fa0708304e027217"/></dir></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="template"><dir name="rememberme"><file name="checkbox.phtml" hash="a8d81237d312626c02af7af023355b6f"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clockworkgeek_Rememberme.xml" hash="4615cfb14e0d8f0296e8695e86bc7564"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Clockworkgeek_Rememberme.csv" hash="5346ff4284ea8a4a8f504d1668981e60"/></dir></target><target name="mageweb"><dir name="var"><dir name="connect"><file name="Clockworkgeek_Rememberme.xml" hash="8d9f51925f65b0492b3e032a5b6657a2"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
var/connect/Clockworkgeek_Rememberme.xml ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <_>
2
+ <form_key>JhBQI0YXFA7AhpyD</form_key>
3
+ <name>Clockworkgeek_Rememberme</name>
4
+ <channel>community</channel>
5
+ <version_ids>
6
+ <version_ids>2</version_ids>
7
+ </version_ids>
8
+ <summary>Add a &quot;remember me&quot; option to login forms.</summary>
9
+ <description>Add a &quot;remember me&quot; option to login forms. Overrides default forms with those in &quot;design/frontend/base/default/template/rememberme/&quot;.</description>
10
+ <license>OSL v3.0</license>
11
+ <license_uri>http://www.opensource.org/licenses/osl-3.0.php</license_uri>
12
+ <version>0.5.0</version>
13
+ <stability>stable</stability>
14
+ <notes>Improved compatibility with all versions and Mage_Captcha and Mage_Persistent modules.</notes>
15
+ <authors>
16
+ <name>
17
+ <name>clockworkgeek</name>
18
+ </name>
19
+ <user>
20
+ <user>nonproffessional</user>
21
+ </user>
22
+ <email>
23
+ <email>nonproffessional@clockworkgeek.com</email>
24
+ </email>
25
+ </authors>
26
+ <depends_php_min>5.2.0</depends_php_min>
27
+ <depends_php_max>6.0.0</depends_php_max>
28
+ <depends>
29
+ <package>
30
+ <name>
31
+ <name/>
32
+ </name>
33
+ <channel>
34
+ <channel/>
35
+ </channel>
36
+ <min>
37
+ <min/>
38
+ </min>
39
+ <max>
40
+ <max/>
41
+ </max>
42
+ <files>
43
+ <files> </files>
44
+ </files>
45
+ </package>
46
+ <extension>
47
+ <name>
48
+ <name>Core</name>
49
+ </name>
50
+ <min>
51
+ <min/>
52
+ </min>
53
+ <max>
54
+ <max/>
55
+ </max>
56
+ </extension>
57
+ </depends>
58
+ <contents>
59
+ <target>
60
+ <target>magelocal</target>
61
+ <target>magecommunity</target>
62
+ <target>magecommunity</target>
63
+ <target>magedesign</target>
64
+ <target>magedesign</target>
65
+ <target>magedesign</target>
66
+ <target>magedesign</target>
67
+ <target>mageetc</target>
68
+ <target>magelocale</target>
69
+ </target>
70
+ <path>
71
+ <path/>
72
+ <path>Clockworkgeek/Loginformfallback</path>
73
+ <path>Clockworkgeek/Rememberme</path>
74
+ <path>frontend/base/default/layout/loginformfallback.xml</path>
75
+ <path>frontend/base/default/layout/rememberme.xml</path>
76
+ <path>frontend/base/default/template/loginformfallback</path>
77
+ <path>frontend/base/default/template/rememberme</path>
78
+ <path>modules/Clockworkgeek_Rememberme.xml</path>
79
+ <path>en_US/Clockworkgeek_Rememberme.csv</path>
80
+ </path>
81
+ <type>
82
+ <type>file</type>
83
+ <type>dir</type>
84
+ <type>dir</type>
85
+ <type>file</type>
86
+ <type>file</type>
87
+ <type>dir</type>
88
+ <type>dir</type>
89
+ <type>file</type>
90
+ <type>file</type>
91
+ </type>
92
+ <include>
93
+ <include/>
94
+ <include/>
95
+ <include/>
96
+ <include/>
97
+ <include/>
98
+ <include/>
99
+ <include/>
100
+ <include/>
101
+ <include/>
102
+ </include>
103
+ <ignore>
104
+ <ignore/>
105
+ <ignore/>
106
+ <ignore/>
107
+ <ignore/>
108
+ <ignore/>
109
+ <ignore/>
110
+ <ignore/>
111
+ <ignore/>
112
+ <ignore/>
113
+ </ignore>
114
+ </contents>
115
+ </_>