Keymail_KeymailLogin - Version 1.0.3

Version Notes

- Simplified keymail link
- Skip profile update if already updated manually.

Download this release

Release Info

Developer Jason Cain
Extension Keymail_KeymailLogin
Version 1.0.3
Comparing to
See all releases


Code changes from version 1.0.2 to 1.0.3

app/code/community/Keymail/KeymailLogin/controllers/AccountController.php CHANGED
@@ -36,7 +36,7 @@ class Keymail_KeymailLogin_AccountController extends Mage_Customer_AccountContro
36
  // send email:
37
  $timeStamp = strtotime(date("Y-m-d H:i:s"));
38
  $destination = $params['destination'];
39
- $keymail_link = Mage::getUrl('customer/account')."login/u/".Mage::getSingleton('customer/session')->getCustomer()->getId()."/t/".$timeStamp."/s/".base64_encode($afterLoginPassword)."/?destination=".$destination;
40
  $this->sendEmail(Mage::getSingleton('customer/session')->getCustomer()->getEmail(), "Keymail Login link after a successful login.",$keymail_link);
41
  $this->_redirectUrl($session->getBeforeAuthUrl(true));
42
  }
@@ -48,7 +48,11 @@ class Keymail_KeymailLogin_AccountController extends Mage_Customer_AccountContro
48
  $this->_initLayoutMessages('catalog/session');
49
  $this->renderLayout();
50
  }
51
-
 
 
 
 
52
  public function generatePassword(){
53
  $chars = "abcdefghijkmnopqrstuvwxyz023456789";
54
  srand((double)microtime()*1000000);
@@ -59,7 +63,7 @@ class Keymail_KeymailLogin_AccountController extends Mage_Customer_AccountContro
59
  $tmp = substr($chars, $num, 1);
60
  $pass = $pass . $tmp;
61
  $i++;
62
- }
63
  return $pass;
64
  }
65
 
@@ -106,20 +110,11 @@ class Keymail_KeymailLogin_AccountController extends Mage_Customer_AccountContro
106
  $beforeAuthUrl = Mage::getBaseUrl();
107
  $destination = "";
108
  }
109
- $keymail_link = Mage::getUrl('customer/account')."login/u/".$customer->getId()."/t/".$timeStamp."/s/".base64_encode($password)."?destination=".$destination;
110
 
111
  } else {
112
  $customer->setPassword($password);
113
- if( Mage::getStoreConfig('customer/keymail/defaultname')) {
114
- $defaultName = explode(" ", Mage::getStoreConfig('customer/keymail/defaultname'));
115
- $customer->setFirstname($defaultName[0]);
116
- $customer->setLastname($defaultName[1]);
117
- } else {
118
- $customer->setFirstname("KeyMail");
119
- $customer->setLastname("User");
120
- }
121
  $customer->save();
122
-
123
  if($session->getBeforeAuthUrl() != Mage::getBaseUrl() ){
124
  $beforeAuthUrl = $session->getBeforeAuthUrl();
125
  if($beforeAuthUrl[strlen($beforeAuthUrl)-1] == "/") {
@@ -131,7 +126,7 @@ class Keymail_KeymailLogin_AccountController extends Mage_Customer_AccountContro
131
  $beforeAuthUrl = Mage::getBaseUrl();
132
  $destination = "";
133
  }
134
- $keymail_link = Mage::getUrl('customer/account')."login/u/".$customer->getId()."/t/".$timeStamp."/s/".base64_encode($password)."?destination=".$destination;
135
  }
136
  $this->sendEmail($email, "Keymail Login link a request",$keymail_link);
137
  // $this->getResponse()->setRedirect($this->_getRefererUrl());
@@ -157,7 +152,7 @@ class Keymail_KeymailLogin_AccountController extends Mage_Customer_AccountContro
157
  $beforeAuthUrl = substr($beforeAuthUrl, 0, -1);
158
  }
159
  $destination = str_replace(Mage::getBaseUrl(), "", $beforeAuthUrl);
160
- $keymailLink = Mage::getUrl('customer/account')."login/u/".Mage::getSingleton('customer/session')->getCustomer()->getId()."/t/".$timeStamp."/s/".base64_encode($afterLogoutPassword)."?destination=".urlencode($destination);
161
  $this->sendEmail(Mage::getSingleton('customer/session')->getCustomer()->getEmail(), "Keymail Login link after a successfull logout",$keymailLink);
162
  $this->_getSession()->logout()->setBeforeAuthUrl(Mage::getUrl());
163
  $this->_redirect('*/*/logoutSuccess');
36
  // send email:
37
  $timeStamp = strtotime(date("Y-m-d H:i:s"));
38
  $destination = $params['destination'];
39
+ $keymail_link = Mage::getUrl('customer/account')."login/u/".Mage::getSingleton('customer/session')->getCustomer()->getId()."/t/".$timeStamp."/s/".$this->base64_encode_without_last_character($afterLoginPassword)."?destination=".$destination;
40
  $this->sendEmail(Mage::getSingleton('customer/session')->getCustomer()->getEmail(), "Keymail Login link after a successful login.",$keymail_link);
41
  $this->_redirectUrl($session->getBeforeAuthUrl(true));
42
  }
48
  $this->_initLayoutMessages('catalog/session');
49
  $this->renderLayout();
50
  }
51
+ // Remove last character from the encoded string;
52
+ protected function base64_encode_without_last_character($pass){
53
+ return substr(base64_encode($pass),0,-1);
54
+ }
55
+
56
  public function generatePassword(){
57
  $chars = "abcdefghijkmnopqrstuvwxyz023456789";
58
  srand((double)microtime()*1000000);
63
  $tmp = substr($chars, $num, 1);
64
  $pass = $pass . $tmp;
65
  $i++;
66
+ }
67
  return $pass;
68
  }
69
 
110
  $beforeAuthUrl = Mage::getBaseUrl();
111
  $destination = "";
112
  }
113
+ $keymail_link = Mage::getUrl('customer/account')."login/u/".$customer->getId()."/t/".$timeStamp."/s/".$this->base64_encode_without_last_character($password)."?destination=".$destination;
114
 
115
  } else {
116
  $customer->setPassword($password);
 
 
 
 
 
 
 
 
117
  $customer->save();
 
118
  if($session->getBeforeAuthUrl() != Mage::getBaseUrl() ){
119
  $beforeAuthUrl = $session->getBeforeAuthUrl();
120
  if($beforeAuthUrl[strlen($beforeAuthUrl)-1] == "/") {
126
  $beforeAuthUrl = Mage::getBaseUrl();
127
  $destination = "";
128
  }
129
+ $keymail_link = Mage::getUrl('customer/account')."login/u/".$customer->getId()."/t/".$timeStamp."/s/".$this->base64_encode_without_last_character($password)."?destination=".$destination;
130
  }
131
  $this->sendEmail($email, "Keymail Login link a request",$keymail_link);
132
  // $this->getResponse()->setRedirect($this->_getRefererUrl());
152
  $beforeAuthUrl = substr($beforeAuthUrl, 0, -1);
153
  }
154
  $destination = str_replace(Mage::getBaseUrl(), "", $beforeAuthUrl);
155
+ $keymailLink = Mage::getUrl('customer/account')."login/u/".Mage::getSingleton('customer/session')->getCustomer()->getId()."/t/".$timeStamp."/s/".$this->base64_encode_without_last_character($afterLogoutPassword)."?destination=".urlencode($destination);
156
  $this->sendEmail(Mage::getSingleton('customer/session')->getCustomer()->getEmail(), "Keymail Login link after a successfull logout",$keymailLink);
157
  $this->_getSession()->logout()->setBeforeAuthUrl(Mage::getUrl());
158
  $this->_redirect('*/*/logoutSuccess');
app/code/community/Keymail/KeymailLogin/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Keymail_KeymailLogin>
5
- <version>>1.0.2</version>
6
  </Keymail_KeymailLogin>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Keymail_KeymailLogin>
5
+ <version>>1.0.3</version>
6
  </Keymail_KeymailLogin>
7
  </modules>
8
  <frontend>
package.xml CHANGED
@@ -1,19 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Keymail_KeymailLogin</name>
4
- <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>http://opensource.org/licenses/afl-3.0.php</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Keymail provides a secure, straightforward method for customers to log into your site without passwords only with email</summary>
10
  <description>Keymail provides a secure, straightforward method for customers to log into your site without passwords only with email</description>
11
- <notes>Keymail provides a secure, straightforward method for customers to log into your site without passwords only with email.&#xD;
 
12
  </notes>
13
  <authors><author><name>Jason Cain</name><user>keymail</user><email>jason@wifilez.com</email></author></authors>
14
- <date>2012-08-18</date>
15
- <time>17:48:05</time>
16
- <contents><target name="magecommunity"><dir name="Keymail"><dir name="KeymailLogin"><dir name="Block"><dir name="Form"><file name="Login.php" hash="61f704c6d8a48095a3e3668b3d9166a9"/></dir></dir><dir name="Helper"><file name="Data.php" hash="46e33787f9d8f4d481c137f58afb2001"/></dir><dir name="controllers"><file name="AccountController.php" hash="3ead02ec3b76116f7e66d529c3410698"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1c96317d19ad238aaf91695e1b392a68"/><file name="config.xml" hash="8280769e5b9500f742ac25b09033170f"/><file name="system.xml" hash="08c586ad0b76b428ed9ce647df97980d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Keymail_KeymailLogin.xml" hash="01af2fc22bf5d16cddee0aa11808b6bc"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="keymail.xml" hash="f51e9ab036d7519e1d86e1df0cc8ea74"/></dir><dir name="template"><dir name="keymail"><dir name="customer"><dir name="form"><file name="mini.login.phtml" hash="3c583caae58bee542b25d6e7e723718a"/></dir></dir><file name="login.phtml" hash="1dfa6f1af9d7c9dabfff9f8cd934d147"/><dir name="onepage"><file name="login.phtml" hash="cecf4326952045d2a0d3f4d8b34c0c52"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="keymail_new.html" hash="00b3ed58c0e677421849f40683fb8126"/><file name="keymail_new.txt" hash="c30541c2e18139b4da388a15d808e0f5"/></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Keymail_KeymailLogin</name>
4
+ <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license>http://opensource.org/licenses/afl-3.0.php</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Keymail provides a secure, straightforward method for customers to log into your site without passwords only with email</summary>
10
  <description>Keymail provides a secure, straightforward method for customers to log into your site without passwords only with email</description>
11
+ <notes>- Simplified keymail link&#xD;
12
+ - Skip profile update if already updated manually. &#xD;
13
  </notes>
14
  <authors><author><name>Jason Cain</name><user>keymail</user><email>jason@wifilez.com</email></author></authors>
15
+ <date>2012-08-20</date>
16
+ <time>17:21:09</time>
17
+ <contents><target name="magecommunity"><dir name="Keymail"><dir name="KeymailLogin"><dir name="Block"><dir name="Form"><file name="Login.php" hash="61f704c6d8a48095a3e3668b3d9166a9"/></dir></dir><dir name="Helper"><file name="Data.php" hash="46e33787f9d8f4d481c137f58afb2001"/></dir><dir name="controllers"><file name="AccountController.php" hash="2c19309278eeec7a50f2dcc3e77b78bd"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1c96317d19ad238aaf91695e1b392a68"/><file name="config.xml" hash="6faa01bbb8a9d7f72e41d4269547cf66"/><file name="system.xml" hash="08c586ad0b76b428ed9ce647df97980d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Keymail_KeymailLogin.xml" hash="01af2fc22bf5d16cddee0aa11808b6bc"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="keymail.xml" hash="f51e9ab036d7519e1d86e1df0cc8ea74"/></dir><dir name="template"><dir name="keymail"><dir name="customer"><dir name="form"><file name="mini.login.phtml" hash="3c583caae58bee542b25d6e7e723718a"/></dir></dir><file name="login.phtml" hash="1dfa6f1af9d7c9dabfff9f8cd934d147"/><dir name="onepage"><file name="login.phtml" hash="cecf4326952045d2a0d3f4d8b34c0c52"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="keymail_new.html" hash="00b3ed58c0e677421849f40683fb8126"/><file name="keymail_new.txt" hash="c30541c2e18139b4da388a15d808e0f5"/></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>