Janrain_Engage_Plugin - Version 1.1.1

Version Notes

Using more standard authentication methods; fixed an xdcomm bug when used with hosted Enterprise versions.

Download this release

Release Info

Developer Magento Core Team
Extension Janrain_Engage_Plugin
Version 1.1.1
Comparing to
See all releases


Code changes from version 1.1.0 to 1.1.1

Files changed (32) hide show
  1. app/code/local/Janrain/Engage/Block/Accountdata.php +20 -20
  2. app/code/local/Janrain/Engage/Block/Auth.php +34 -33
  3. app/code/local/Janrain/Engage/Block/Info.php +1 -1
  4. app/code/local/Janrain/Engage/Block/Share.php +38 -38
  5. app/code/local/Janrain/Engage/Block/Xdcomm.php +25 -0
  6. app/code/local/Janrain/Engage/Helper/Data.php +115 -115
  7. app/code/local/Janrain/Engage/Helper/Identifiers.php +80 -82
  8. app/code/local/Janrain/Engage/Helper/Rpxcall.php +64 -79
  9. app/code/local/Janrain/Engage/Model/Customer.php +0 -21
  10. app/code/local/Janrain/Engage/Model/Identifiers.php +4 -4
  11. app/code/local/Janrain/Engage/Model/Mysql4/Identifiers.php +4 -4
  12. app/code/local/Janrain/Engage/Model/Mysql4/Identifiers/Collection.php +6 -4
  13. app/code/local/Janrain/Engage/Model/Observer.php +13 -13
  14. app/code/local/Janrain/Engage/Model/Resource/Eav/Mysql4/Setup.php +2 -2
  15. app/code/local/Janrain/Engage/Model/Session.php +7 -29
  16. app/code/local/Janrain/Engage/controllers/Adminhtml/LookupController.php +8 -8
  17. app/code/local/Janrain/Engage/controllers/IndexController.php +0 -27
  18. app/code/local/Janrain/Engage/controllers/RpxController.php +219 -220
  19. app/code/local/Janrain/Engage/etc/config.xml +50 -55
  20. app/code/local/Janrain/Engage/etc/system.xml +20 -19
  21. app/code/local/Janrain/Engage/etc/widget.xml +46 -46
  22. app/code/local/Janrain/Engage/sql/engage_setup/{mysql4-install-1.1.0.php → mysql4-install-1.1.1.php} +0 -0
  23. app/design/frontend/base/default/layout/engage.xml +50 -50
  24. app/design/frontend/base/default/template/janrain/engage/dashboard.phtml +57 -58
  25. app/design/frontend/base/default/template/janrain/engage/duplicate.phtml +70 -70
  26. app/design/frontend/base/default/template/janrain/engage/register.phtml +97 -97
  27. app/design/frontend/base/default/template/janrain/engage/scripts.phtml +12 -12
  28. app/design/frontend/base/default/template/janrain/engage/styles.phtml +3 -3
  29. app/etc/modules/Janrain_Engage.xml +8 -7
  30. package.xml +7 -7
  31. skin/frontend/janrain/rpx_xdcomm.html +0 -13
  32. skin/frontend/janrain/stylesheet.css +52 -52
app/code/local/Janrain/Engage/Block/Accountdata.php CHANGED
@@ -14,25 +14,25 @@ class Janrain_Engage_Block_Accountdata extends Mage_Adminhtml_Block_System_Confi
14
}
15
16
protected function _getFieldHtml($fieldset) {
17
- $vars = array(
18
- 'realm' => 'Realm',
19
- 'realmscheme' => 'Realm Scheme',
20
- 'appid' => 'App Id',
21
- 'adminurl' => 'Admin URL',
22
- 'socialpub' => 'Social Pub',
23
- 'enabled_providers' =>'Enabled Providers'
24
- );
25
-
26
- if(Mage::helper('engage')->isEngageEnabled() === false)
27
- return '<p>Module not enabled. Please set "Enabled" to "Yes" and enter your API key above.</p>';
28
29
$content = '<link type="text/css" href="' . Mage::helper('engage')->_baseSkin() . '/stylesheet.css" rel="stylesheet" />';
30
- $content .= '<p>The following is the current account info being used. <a href="' . Mage::helper('adminhtml')->getUrl('engage/adminhtml_lookup/rp') . '">Click Here to refresh</a></p>';
31
32
- $content .= '<table><tbody>';
33
- foreach($vars as $key => $val){
34
- $value = Mage::getStoreConfig('engage/vars/' . $key);
35
-
36
if ($value && ($key == 'socialpub' || $key == 'enabled_providers')) {
37
$providers = explode(",", $value);
38
$value = '<a class="rpx-icons" href="' . Mage::getStoreConfig('engage/vars/adminurl') . '" target="_blank">';
@@ -43,11 +43,11 @@ class Janrain_Engage_Block_Accountdata extends Mage_Adminhtml_Block_System_Confi
43
}
44
elseif ($key == 'adminurl')
45
$value = '<a href="' . $value . '" target="_blank">' . $value . '</a>';
46
-
47
- $content .= '<tr><td><em>' . $val . ':</em></td><td>' . $value . '</td></tr>';
48
- }
49
$content .= '</tbody></table>';
50
-
51
return $content;
52
}
53
14
}
15
16
protected function _getFieldHtml($fieldset) {
17
+ $vars = array(
18
+ 'realm' => 'Realm',
19
+ 'realmscheme' => 'Realm Scheme',
20
+ 'appid' => 'App Id',
21
+ 'adminurl' => 'Admin URL',
22
+ 'socialpub' => 'Social Pub',
23
+ 'enabled_providers' => 'Enabled Providers'
24
+ );
25
+
26
+ if (Mage::helper('engage')->isEngageEnabled() === false)
27
+ return '<p>Module not enabled. Please set "Enabled" to "Yes" and enter your API key above.</p>';
28
29
$content = '<link type="text/css" href="' . Mage::helper('engage')->_baseSkin() . '/stylesheet.css" rel="stylesheet" />';
30
+ $content .= '<p>The following is the current account info being used. <a href="' . Mage::helper('adminhtml')->getUrl('engage/adminhtml_lookup/rp') . '">Click Here to refresh</a></p>';
31
+
32
+ $content .= '<table><tbody>';
33
+ foreach ($vars as $key => $val) {
34
+ $value = Mage::getStoreConfig('engage/vars/' . $key);
35
36
if ($value && ($key == 'socialpub' || $key == 'enabled_providers')) {
37
$providers = explode(",", $value);
38
$value = '<a class="rpx-icons" href="' . Mage::getStoreConfig('engage/vars/adminurl') . '" target="_blank">';
43
}
44
elseif ($key == 'adminurl')
45
$value = '<a href="' . $value . '" target="_blank">' . $value . '</a>';
46
+
47
+ $content .= '<tr><td><em>' . $val . ':</em></td><td>' . $value . '</td></tr>';
48
+ }
49
$content .= '</tbody></table>';
50
+
51
return $content;
52
}
53
app/code/local/Janrain/Engage/Block/Auth.php CHANGED
@@ -2,7 +2,7 @@
2
3
class Janrain_Engage_Block_Auth extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface {
4
5
- function rpx_small_buttons() {
6
$size = $this->getSize();
7
if ($size == 'inline') {
8
$iframe = '<iframe src="'
@@ -11,17 +11,18 @@ class Janrain_Engage_Block_Auth extends Mage_Core_Block_Template implements Mage
11
. '/openid/embed?token_url=' . urlencode(Mage::getUrl('engage/rpx/token_url'))
12
. '" scrolling="no" frameBorder="no" allowtransparency="true" style="width:400px;height:240px"></iframe>';
13
return $iframe;
14
- } else {
15
$providers = Mage::helper('engage')->getRpxProviders();
16
if (is_array($providers)) {
17
$size = ($size == 'small') ? "16" : "30";
18
$wrap_open = '<a class="rpxnow rpx_link_wrap" onclick="return false;" href="'
19
- . Mage::helper('engage')->getRpxAuthUrl()
20
- . '">';
21
$wrap_close = '</a>';
22
23
$labelText = $this->getLabelText();
24
- if(empty($labelText))
25
$labelText = 'Or log in with';
26
27
$label = '<div class="rpx_label">' . $labelText . '</div>';
@@ -34,37 +35,37 @@ class Janrain_Engage_Block_Auth extends Mage_Core_Block_Template implements Mage
34
return $wrap_open . $label . $buttons . $wrap_close;
35
}
36
}
37
- }
38
39
- protected function _toHtml() {
40
- $content = '';
41
- if (Mage::getSingleton('customer/session')->isLoggedIn() == false)
42
- $content = $this->rpx_small_buttons();
43
- return $content;
44
- }
45
46
- protected function _prepareLayout() {
47
48
- /*
49
- * Doesn't work on inline widgets because layout isn't loaded until
50
- * after the head has been written to the page. Fix.
51
- *
52
- if($this->getLayout()->getBlock('janrain_engage_styles')==false) {
53
- $block = $this->getLayout()
54
- ->createBlock('core/template', 'janrain_engage_styles')
55
- ->setTemplate('janrain/engage/styles.phtml');
56
- $this->getLayout()->getBlock('head')->insert($block);
57
- }
58
- */
59
60
- if($this->getLayout()->getBlock('janrain_engage_scripts')==false) {
61
- $block = $this->getLayout()
62
- ->createBlock('core/template', 'janrain_engage_scripts')
63
- ->setTemplate('janrain/engage/scripts.phtml');
64
- $this->getLayout()->getBlock('before_body_end')->insert($block);
65
- }
66
67
- parent::_prepareLayout();
68
- }
69
70
- }
2
3
class Janrain_Engage_Block_Auth extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface {
4
5
+ function rpx_small_buttons() {
6
$size = $this->getSize();
7
if ($size == 'inline') {
8
$iframe = '<iframe src="'
11
. '/openid/embed?token_url=' . urlencode(Mage::getUrl('engage/rpx/token_url'))
12
. '" scrolling="no" frameBorder="no" allowtransparency="true" style="width:400px;height:240px"></iframe>';
13
return $iframe;
14
+ }
15
+ else {
16
$providers = Mage::helper('engage')->getRpxProviders();
17
if (is_array($providers)) {
18
$size = ($size == 'small') ? "16" : "30";
19
$wrap_open = '<a class="rpxnow rpx_link_wrap" onclick="return false;" href="'
20
+ . Mage::helper('engage')->getRpxAuthUrl()
21
+ . '">';
22
$wrap_close = '</a>';
23
24
$labelText = $this->getLabelText();
25
+ if (empty($labelText))
26
$labelText = 'Or log in with';
27
28
$label = '<div class="rpx_label">' . $labelText . '</div>';
35
return $wrap_open . $label . $buttons . $wrap_close;
36
}
37
}
38
+ }
39
40
+ protected function _toHtml() {
41
+ $content = '';
42
+ if (Mage::getSingleton('customer/session')->isLoggedIn() == false)
43
+ $content = $this->rpx_small_buttons();
44
+ return $content;
45
+ }
46
47
+ protected function _prepareLayout() {
48
49
+ /*
50
+ * Doesn't work on inline widgets because layout isn't loaded until
51
+ * after the head has been written to the page. Fix.
52
+ *
53
+ if($this->getLayout()->getBlock('janrain_engage_styles')==false) {
54
+ $block = $this->getLayout()
55
+ ->createBlock('core/template', 'janrain_engage_styles')
56
+ ->setTemplate('janrain/engage/styles.phtml');
57
+ $this->getLayout()->getBlock('head')->insert($block);
58
+ }
59
+ */
60
61
+ if ($this->getLayout()->getBlock('janrain_engage_scripts') == false) {
62
+ $block = $this->getLayout()
63
+ ->createBlock('core/template', 'janrain_engage_scripts')
64
+ ->setTemplate('janrain/engage/scripts.phtml');
65
+ $this->getLayout()->getBlock('before_body_end')->insert($block);
66
+ }
67
68
+ parent::_prepareLayout();
69
+ }
70
71
+ }
app/code/local/Janrain/Engage/Block/Info.php CHANGED
@@ -17,7 +17,7 @@ class Janrain_Engage_Block_Info extends Mage_Adminhtml_Block_System_Config_Form_
17
$content = '<p>Janrain Engage for Magento ' . Mage::getConfig()->getModuleConfig("Janrain_Engage")->version . '</p>';
18
$content.= '<p>This extension is developed by <a href="http://janrain.com/" target="_blank">Janrain</a>. Please refer to our <a href="http://documentation.janrain.com/engage/plugins-modules/magento" target="_blank">Documentation</a> on how to install and configure this extension.</p>';
19
$content.= '<p>Copyright &copy ' . date("Y") . ' <a href="http://janrain.com/" target="_blank">Janrain, Inc.</a></p>';
20
-
21
return $content;
22
}
23
17
$content = '<p>Janrain Engage for Magento ' . Mage::getConfig()->getModuleConfig("Janrain_Engage")->version . '</p>';
18
$content.= '<p>This extension is developed by <a href="http://janrain.com/" target="_blank">Janrain</a>. Please refer to our <a href="http://documentation.janrain.com/engage/plugins-modules/magento" target="_blank">Documentation</a> on how to install and configure this extension.</p>';
19
$content.= '<p>Copyright &copy ' . date("Y") . ' <a href="http://janrain.com/" target="_blank">Janrain, Inc.</a></p>';
20
+
21
return $content;
22
}
23
app/code/local/Janrain/Engage/Block/Share.php CHANGED
@@ -2,7 +2,7 @@
2
3
class Janrain_Engage_Block_Share extends Mage_Core_Block_Abstract implements Mage_Widget_Block_Interface {
4
5
- public function rpx_social_icons() {
6
$social_pub = Mage::getStoreConfig('engage/vars/socialpub');
7
$social_providers = array_filter(explode(',', $social_pub));
8
if (is_array($social_providers)) {
@@ -14,46 +14,46 @@ class Janrain_Engage_Block_Share extends Mage_Core_Block_Abstract implements Mag
14
return $buttons;
15
}
16
return false;
17
- }
18
-
19
- /**
20
- * Adds a link to open the Engage authentication dialog
21
- *
22
- * @return string
23
- */
24
- protected function _toHtml() {
25
$link = '';
26
-
27
if ($icons = $this->rpx_social_icons()) {
28
$link .= '<div class="rpxsocial rpx_tooltip" onclick="RPXNOW.loadAndRun([\'Social\'], function () { var activity = new RPXNOW.Social.Activity(\'Share:\', \'' . Mage::getSingleton('cms/page')->getTitle() . '\', \'' . Mage::helper('core/url')->getCurrentUrl() . '\'); activity.setUserGeneratedContent(\'' . $this->getShareText() . '\'); RPXNOW.Social.publishActivity(activity); });">';
29
$link .= '<span class="rpxsharebutton">share</span><div class="rpx_share_tip">Share this on:<br />' . $icons . '</div></div>';
30
}
31
32
- return $link;
33
- }
34
-
35
- protected function _prepareLayout() {
36
-
37
- /*
38
- * Doesn't work on inline widgets because layout isn't loaded until
39
- * after the head has been written to the page. Fix.
40
- *
41
- if($this->getLayout()->getBlock('janrain_engage_styles')==false) {
42
- $block = $this->getLayout()
43
- ->createBlock('core/template', 'janrain_engage_styles')
44
- ->setTemplate('janrain/engage/styles.phtml');
45
- $this->getLayout()->getBlock('head')->insert($block);
46
- }
47
- */
48
-
49
- if($this->getLayout()->getBlock('janrain_engage_scripts')==false) {
50
- $block = $this->getLayout()
51
- ->createBlock('core/template', 'janrain_engage_scripts')
52
- ->setTemplate('janrain/engage/scripts.phtml');
53
- $this->getLayout()->getBlock('before_body_end')->insert($block);
54
- }
55
-
56
- parent::_prepareLayout();
57
- }
58
-
59
- }
2
3
class Janrain_Engage_Block_Share extends Mage_Core_Block_Abstract implements Mage_Widget_Block_Interface {
4
5
+ public function rpx_social_icons() {
6
$social_pub = Mage::getStoreConfig('engage/vars/socialpub');
7
$social_providers = array_filter(explode(',', $social_pub));
8
if (is_array($social_providers)) {
14
return $buttons;
15
}
16
return false;
17
+ }
18
+
19
+ /**
20
+ * Adds a link to open the Engage authentication dialog
21
+ *
22
+ * @return string
23
+ */
24
+ protected function _toHtml() {
25
$link = '';
26
+
27
if ($icons = $this->rpx_social_icons()) {
28
$link .= '<div class="rpxsocial rpx_tooltip" onclick="RPXNOW.loadAndRun([\'Social\'], function () { var activity = new RPXNOW.Social.Activity(\'Share:\', \'' . Mage::getSingleton('cms/page')->getTitle() . '\', \'' . Mage::helper('core/url')->getCurrentUrl() . '\'); activity.setUserGeneratedContent(\'' . $this->getShareText() . '\'); RPXNOW.Social.publishActivity(activity); });">';
29
$link .= '<span class="rpxsharebutton">share</span><div class="rpx_share_tip">Share this on:<br />' . $icons . '</div></div>';
30
}
31
32
+ return $link;
33
+ }
34
+
35
+ protected function _prepareLayout() {
36
+
37
+ /*
38
+ * Doesn't work on inline widgets because layout isn't loaded until
39
+ * after the head has been written to the page. Fix.
40
+ *
41
+ if($this->getLayout()->getBlock('janrain_engage_styles')==false) {
42
+ $block = $this->getLayout()
43
+ ->createBlock('core/template', 'janrain_engage_styles')
44
+ ->setTemplate('janrain/engage/styles.phtml');
45
+ $this->getLayout()->getBlock('head')->insert($block);
46
+ }
47
+ */
48
+
49
+ if ($this->getLayout()->getBlock('janrain_engage_scripts') == false) {
50
+ $block = $this->getLayout()
51
+ ->createBlock('core/template', 'janrain_engage_scripts')
52
+ ->setTemplate('janrain/engage/scripts.phtml');
53
+ $this->getLayout()->getBlock('before_body_end')->insert($block);
54
+ }
55
+
56
+ parent::_prepareLayout();
57
+ }
58
+
59
+ }
app/code/local/Janrain/Engage/Block/Xdcomm.php ADDED
@@ -0,0 +1,25 @@
1
+ <?php
2
+
3
+ class Janrain_Engage_Block_Xdcomm extends Mage_Core_Block_Abstract {
4
+
5
+ protected function _toHtml() {
6
+ $html = '
7
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
8
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
9
+ <html xmlns="http://www.w3.org/1999/xhtml" >
10
+ <head>
11
+ <title>Cross-Domain Receiver Page</title>
12
+ </head>
13
+ <body>
14
+ <script type="text/javascript">
15
+ var rpxJsHost = (("https:" == document.location.protocol) ? "https://" : "http://static.");
16
+ document.write(unescape("%3Cscript src=\'" + rpxJsHost + "rpxnow.com/js/lib/xdcomm.js\' type=\'text/javascript\'%3E%3C/script%3E"));
17
+ </script>
18
+ </body>
19
+ </html>
20
+ ';
21
+
22
+ return $html;
23
+ }
24
+
25
+ }
app/code/local/Janrain/Engage/Helper/Data.php CHANGED
@@ -2,118 +2,118 @@
2
3
class Janrain_Engage_Helper_Data extends Mage_Core_Helper_Abstract {
4
5
- private $providers = array(
6
- 'Facebook' => 'facebook',
7
- 'Google' => 'google',
8
- 'LinkedIn' => 'linkedin',
9
- 'MySpace' => 'myspace',
10
- 'Twitter' => 'twitter',
11
- 'Windows Live' => 'live_id',
12
- 'Yahoo!' => 'yahoo',
13
- 'AOL' => 'aol',
14
- 'Blogger' => 'blogger',
15
- 'Flickr' => 'flickr',
16
- 'Hyves' => 'hyves',
17
- 'Livejournal' => 'livejournal',
18
- 'MyOpenID' => 'myopenid',
19
- 'Netlog' => 'netlog',
20
- 'OpenID' => 'openid',
21
- 'Verisign' => 'verisign',
22
- 'Wordpress' => 'wordpress',
23
- 'PayPal' => 'paypal'
24
- );
25
-
26
- /**
27
- * Returns whether the Enabled config variable is set to true
28
- *
29
- * @return bool
30
- */
31
- public function isEngageEnabled() {
32
- if(Mage::getStoreConfig('engage/options/enable')=='1' && strlen(Mage::getStoreConfig('engage/options/apikey')) > 1)
33
- return true;
34
-
35
- return false;
36
- }
37
-
38
- /**
39
- * Returns random alphanumber string
40
- *
41
- * @param int $length
42
- * @param string $chars
43
- * @return string
44
- */
45
- public function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890') {
46
- $chars_length = (strlen($chars) - 1);
47
-
48
- $string = $chars{rand(0, $chars_length)};
49
-
50
- for ($i = 1; $i < $length; $i = strlen($string)) {
51
- $r = $chars{rand(0, $chars_length)};
52
-
53
- if ($r != $string{$i - 1})
54
- $string .= $r;
55
- }
56
-
57
- return $string;
58
- }
59
-
60
- /**
61
- * Returns the url of skin directory containing scripts and styles
62
- *
63
- * @return string
64
- */
65
- public function _baseSkin() {
66
- return Mage::getBaseUrl('skin') . "frontend/janrain";
67
- }
68
-
69
- /**
70
- * Returns the full Auth URL for the Engage Sign In Widget
71
- *
72
- * @return string
73
- */
74
- public function getRpxAuthUrl($add=false) {
75
- $action = $add ? 'engage/rpx/token_url_add' : 'engage/rpx/token_url';
76
- $rpx_callback = urlencode(Mage::getUrl($action));
77
- $link = (Mage::getStoreConfig('engage/vars/realmscheme') == 'https') ? 'https' : 'http';
78
- $link.= '://' . Mage::getStoreConfig('engage/vars/realm');
79
- $link.= '/openid/v2/signin?token_url=' . $rpx_callback;
80
-
81
- return $link;
82
- }
83
-
84
- /**
85
- * Returns an unserialized array of available providers
86
- * or Null if empty (Invalid or missing API Key)
87
- *
88
- * @return string
89
- */
90
- public function getRpxProviders() {
91
- $providers = Mage::getStoreConfig('engage/vars/enabled_providers');
92
- if($providers)
93
- return explode(",", $providers);
94
- else
95
- return false;
96
- }
97
-
98
- public function buildProfile($auth_info) {
99
- $profile_name = false;
100
-
101
- if(isset($auth_info->profile->preferredUsername))
102
- $profile_name = $auth_info->profile->preferredUsername;
103
-
104
- else if(isset($auth_info->profile->email))
105
- $profile_name = $auth_info->profile->email;
106
-
107
- else if(isset($auth_info->profile->displayName))
108
- $profile_name = $auth_info->profile->displayName;
109
-
110
- else if(isset($auth_info->profile->name->formatted))
111
- $profile_name = $auth_info->profile->name->formatted;
112
-
113
- else
114
- $profile_name = $auth_info->profile->providerName;
115
-
116
- return array('provider' => $this->providers[$auth_info->profile->providerName], 'identifier' => $auth_info->profile->identifier, 'profile_name' => $profile_name);
117
- }
118
-
119
- }
2
3
class Janrain_Engage_Helper_Data extends Mage_Core_Helper_Abstract {
4
5
+ private $providers = array(
6
+ 'Facebook' => 'facebook',
7
+ 'Google' => 'google',
8
+ 'LinkedIn' => 'linkedin',
9
+ 'MySpace' => 'myspace',
10
+ 'Twitter' => 'twitter',
11
+ 'Windows Live' => 'live_id',
12
+ 'Yahoo!' => 'yahoo',
13
+ 'AOL' => 'aol',
14
+ 'Blogger' => 'blogger',
15
+ 'Flickr' => 'flickr',
16
+ 'Hyves' => 'hyves',
17
+ 'Livejournal' => 'livejournal',
18
+ 'MyOpenID' => 'myopenid',
19
+ 'Netlog' => 'netlog',
20
+ 'OpenID' => 'openid',
21
+ 'Verisign' => 'verisign',
22
+ 'Wordpress' => 'wordpress',
23
+ 'PayPal' => 'paypal'
24
+ );
25
+
26
+ /**
27
+ * Returns whether the Enabled config variable is set to true
28
+ *
29
+ * @return bool
30
+ */
31
+ public function isEngageEnabled() {
32
+ if (Mage::getStoreConfig('engage/options/enable') == '1' && strlen(Mage::getStoreConfig('engage/options/apikey')) > 1)
33
+ return true;
34
+
35
+ return false;
36
+ }
37
+
38
+ /**
39
+ * Returns random alphanumber string
40
+ *
41
+ * @param int $length
42
+ * @param string $chars
43
+ * @return string
44
+ */
45
+ public function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890') {
46
+ $chars_length = (strlen($chars) - 1);
47
+
48
+ $string = $chars{rand(0, $chars_length)};
49
+
50
+ for ($i = 1; $i < $length; $i = strlen($string)) {
51
+ $r = $chars{rand(0, $chars_length)};
52
+
53
+ if ($r != $string{$i - 1})
54
+ $string .= $r;
55
+ }
56
+
57
+ return $string;
58
+ }
59
+
60
+ /**
61
+ * Returns the url of skin directory containing scripts and styles
62
+ *
63
+ * @return string
64
+ */
65
+ public function _baseSkin() {
66
+ return Mage::getBaseUrl('skin') . "frontend/janrain";
67
+ }
68
+
69
+ /**
70
+ * Returns the full Auth URL for the Engage Sign In Widget
71
+ *
72
+ * @return string
73
+ */
74
+ public function getRpxAuthUrl($add=false) {
75
+ $action = $add ? 'engage/rpx/token_url_add' : 'engage/rpx/token_url';
76
+ $rpx_callback = urlencode(Mage::getUrl($action));
77
+ $link = (Mage::getStoreConfig('engage/vars/realmscheme') == 'https') ? 'https' : 'http';
78
+ $link.= '://' . Mage::getStoreConfig('engage/vars/realm');
79
+ $link.= '/openid/v2/signin?token_url=' . $rpx_callback;
80
+
81
+ return $link;
82
+ }
83
+
84
+ /**
85
+ * Returns an unserialized array of available providers
86
+ * or Null if empty (Invalid or missing API Key)
87
+ *
88
+ * @return string
89
+ */
90
+ public function getRpxProviders() {
91
+ $providers = Mage::getStoreConfig('engage/vars/enabled_providers');
92
+ if ($providers)
93
+ return explode(",", $providers);
94
+ else
95
+ return false;
96
+ }
97
+
98
+ public function buildProfile($auth_info) {
99
+ $profile_name = false;
100
+
101
+ if (isset($auth_info->profile->preferredUsername))
102
+ $profile_name = $auth_info->profile->preferredUsername;
103
+
104
+ else if (isset($auth_info->profile->email))
105
+ $profile_name = $auth_info->profile->email;
106
+
107
+ else if (isset($auth_info->profile->displayName))
108
+ $profile_name = $auth_info->profile->displayName;
109
+
110
+ else if (isset($auth_info->profile->name->formatted))
111
+ $profile_name = $auth_info->profile->name->formatted;
112
+
113
+ else
114
+ $profile_name = $auth_info->profile->providerName;
115
+
116
+ return array('provider' => $this->providers[$auth_info->profile->providerName], 'identifier' => $auth_info->profile->identifier, 'profile_name' => $profile_name);
117
+ }
118
+
119
+ }
app/code/local/Janrain/Engage/Helper/Identifiers.php CHANGED
@@ -1,96 +1,94 @@
1
<?php
2
- class Janrain_Engage_Helper_Identifiers extends Mage_Core_Helper_Abstract {
3
4
- /**
5
- * Assigns a new identifier to a customer
6
- *
7
- * @param int $customer_id
8
- * @param string $identifier
9
- */
10
- public function save_identifier($customer_id, $profile) {
11
12
- /**
13
- * Make sure we have a valid customer_id
14
- *
15
- */
16
- $customer = Mage::getModel('customer/customer')
17
- ->getCollection()
18
- ->addFieldToFilter('entity_id', $customer_id)
19
- ->getFirstItem();
20
- if(!$customer->getId())
21
- Mage::throwException('Invalid Customer ID');
22
23
- /**
24
- * Make the save
25
- *
26
- */
27
- try {
28
- Mage::getModel('engage/identifiers')
29
- ->setIdentifier($profile['identifier'])
30
- ->setProvider($profile['provider'])
31
- ->setProfileName($profile['profile_name'])
32
- ->setCustomerId($customer_id)
33
- ->save();
34
- }
35
- catch (Exception $e) {
36
- echo "Could not save: " . $e->getMessage() . "\n";
37
- }
38
39
- }
40
41
- /**
42
- * Gets a customer by identifier
43
- *
44
- * @param string $identifier
45
- * @return Mage_Customer_Model_Customer
46
- */
47
- public function get_customer($identifier) {
48
- $customer_id = Mage::getModel('engage/identifiers')
49
- ->getCollection()
50
- ->addFieldToFilter('identifier', $identifier)
51
- ->getFirstItem();
52
53
- $customer_id = $customer_id->getCustomerId();
54
- if((int) $customer_id > 0) {
55
- $customer = Mage::getModel('customer/customer')
56
- ->getCollection()
57
- ->addFieldToFilter('entity_id', $customer_id)
58
- ->getFirstItem();
59
- return $customer;
60
- }
61
62
- return false;
63
- }
64
65
- public function get_identifiers($customer_id) {
66
- if((int) $customer_id > 0){
67
- $identifiers = Mage::getModel('engage/identifiers')
68
- ->getCollection()
69
- ->addFieldToFilter('customer_id', $customer_id);
70
71
- return $identifiers;
72
- }
73
74
- return false;
75
- }
76
77
- public function delete_identifier($id) {
78
- $customer_id = Mage::getSingleton('customer/session')
79
- ->getCustomer()
80
- ->getId();
81
82
- $identifier = Mage::getModel('engage/identifiers')
83
- ->getCollection()
84
- ->addFieldToFilter('engage_identifier_id', $id)
85
- ->getFirstItem();
86
- if($identifier->getCustomerId() == $customer_id) {
87
- try {
88
- $identifier->delete();
89
- } catch (Exception $e) {
90
- echo "Could not delete: $e";
91
- }
92
- }
93
-
94
- }
95
96
- }
1
<?php
2
3
+ class Janrain_Engage_Helper_Identifiers extends Mage_Core_Helper_Abstract {
4
5
+ /**
6
+ * Assigns a new identifier to a customer
7
+ *
8
+ * @param int $customer_id
9
+ * @param string $identifier
10
+ */
11
+ public function save_identifier($customer_id, $profile) {
12
13
+ /**
14
+ * Make sure we have a valid customer_id
15
+ *
16
+ */
17
+ $customer = Mage::getModel('customer/customer')
18
+ ->getCollection()
19
+ ->addFieldToFilter('entity_id', $customer_id)
20
+ ->getFirstItem();
21
+ if (!$customer->getId())
22
+ Mage::throwException('Invalid Customer ID');
23
24
+ /**
25
+ * Make the save
26
+ *
27
+ */
28
+ try {
29
+ Mage::getModel('engage/identifiers')
30
+ ->setIdentifier($profile['identifier'])
31
+ ->setProvider($profile['provider'])
32
+ ->setProfileName($profile['profile_name'])
33
+ ->setCustomerId($customer_id)
34
+ ->save();
35
+ } catch (Exception $e) {
36
+ echo "Could not save: " . $e->getMessage() . "\n";
37
+ }
38
+ }
39
40
+ /**
41
+ * Gets a customer by identifier
42
+ *
43
+ * @param string $identifier
44
+ * @return Mage_Customer_Model_Customer
45
+ */
46
+ public function get_customer($identifier) {
47
+ $customer_id = Mage::getModel('engage/identifiers')
48
+ ->getCollection()
49
+ ->addFieldToFilter('identifier', $identifier)
50
+ ->getFirstItem();
51
52
+ $customer_id = $customer_id->getCustomerId();
53
+ if ((int) $customer_id > 0) {
54
+ $customer = Mage::getModel('customer/customer')
55
+ ->getCollection()
56
+ ->addFieldToFilter('entity_id', $customer_id)
57
+ ->getFirstItem();
58
+ return $customer;
59
+ }
60
61
+ return false;
62
+ }
63
64
+ public function get_identifiers($customer_id) {
65
+ if ((int) $customer_id > 0) {
66
+ $identifiers = Mage::getModel('engage/identifiers')
67
+ ->getCollection()
68
+ ->addFieldToFilter('customer_id', $customer_id);
69
70
+ return $identifiers;
71
+ }
72
73
+ return false;
74
+ }
75
76
+ public function delete_identifier($id) {
77
+ $customer_id = Mage::getSingleton('customer/session')
78
+ ->getCustomer()
79
+ ->getId();
80
81
+ $identifier = Mage::getModel('engage/identifiers')
82
+ ->getCollection()
83
+ ->addFieldToFilter('engage_identifier_id', $id)
84
+ ->getFirstItem();
85
+ if ($identifier->getCustomerId() == $customer_id) {
86
+ try {
87
+ $identifier->delete();
88
+ } catch (Exception $e) {
89
+ echo "Could not delete: $e";
90
+ }
91
+ }
92
+ }
93
94
+ }
app/code/local/Janrain/Engage/Helper/Rpxcall.php CHANGED
@@ -2,32 +2,31 @@
2
3
class Janrain_Engage_Helper_Rpxcall extends Mage_Core_Helper_Abstract {
4
5
- public function getEngageApiKey() {
6
- return Mage::getStoreConfig('engage/options/apikey');
7
- }
8
-
9
- public function rpxLookupSave() {
10
- try {
11
- $lookup_rp = $this->rpxLookupRpCall();
12
-
13
- Mage::getModel('core/config')
14
- ->saveConfig('engage/vars/realm', $lookup_rp->realm)
15
- ->saveConfig('engage/vars/realmscheme', $lookup_rp->realmScheme)
16
- ->saveConfig('engage/vars/appid', $lookup_rp->appId)
17
- ->saveConfig('engage/vars/adminurl', $lookup_rp->adminUrl)
18
- ->saveConfig('engage/vars/socialpub', $lookup_rp->socialPub)
19
- ->saveConfig('engage/vars/enabled_providers', $lookup_rp->signinProviders)
20
- ->saveConfig('engage/vars/apikey', Mage::getStoreConfig('engage/options/apikey'));
21
- Mage::getConfig()->reinit();
22
-
23
- return true;
24
-
25
- } catch (Exception $e) {
26
- Mage::getSingleton('adminhtml/session')->addWarning('Could not retrieve account info. Please try again');
27
- }
28
-
29
- return false;
30
- }
31
32
public function rpxLookupRpCall() {
33
$version = Mage::getConfig()->getModuleConfig("Janrain_Engage")->version;
@@ -40,15 +39,13 @@ class Janrain_Engage_Helper_Rpxcall extends Mage_Core_Helper_Abstract {
40
$result = "rpxLookupRpCall: no result";
41
try {
42
$result = $this->rpxPost("lookup_rp", $postParams);
43
- }
44
- catch (Exception $e) {
45
throw Mage::exception('Mage_Core', $e);
46
}
47
48
return $result;
49
-
50
}
51
-
52
public function rpxAuthInfoCall($token) {
53
54
$postParams = array();
@@ -59,25 +56,22 @@ class Janrain_Engage_Helper_Rpxcall extends Mage_Core_Helper_Abstract {
59
$result = "rpxAuthInfoCall: no result";
60
try {
61
$result = $this->rpxPost("auth_info", $postParams);
62
- }
63
- catch (Exception $e) {
64
throw Mage::exception('Mage_Core', $e);
65
}
66
67
return $result;
68
-
69
}
70
71
-
72
public function rpxActivityCall($identifier, $activity_message, $url) {
73
74
$postParams = array();
75
- $activity = new stdClass();
76
77
- $activity->action = $activity_message;
78
- $activity->url = $url;
79
-
80
- $activity_json = json_encode($activity);
81
82
$postParams["activity"] = $activity_json;
83
$postParams["identifier"] = $identifier;
@@ -86,16 +80,13 @@ class Janrain_Engage_Helper_Rpxcall extends Mage_Core_Helper_Abstract {
86
$result = "rpxActivityCall: no result";
87
try {
88
$result = $this->rpxPost("activity", $postParams);
89
- }
90
- catch (Exception $e) {
91
throw Mage::exception('Mage_Core', $e);
92
}
93
94
return $result;
95
-
96
}
97
98
-
99
private function rpxPost($method, $postParams) {
100
101
$rpxbase = "https://rpxnow.com";
@@ -112,33 +103,31 @@ class Janrain_Engage_Helper_Rpxcall extends Mage_Core_Helper_Abstract {
112
else {
113
throw Mage::exception('Mage_Core', "method [$method] not understood");
114
}
115
-
116
- $url = "$rpxbase/$method_fragment";
117
- $method = 'POST';
118
$postParams["format"] = 'json';
119
120
return $this->rpxCall($url, $method, $postParams);
121
-
122
}
123
124
- private function rpxCall($url, $method='GET', $postParams=null) {
125
126
$result = "rpxCallUrl: no result yet";
127
128
try {
129
130
$http = new Varien_Http_Client($url);
131
- $http->setHeaders( array( "Accept-encoding" => "identity" ) );
132
- if($method=='POST')
133
- $http->setParameterPost($postParams);
134
$response = $http->request($method);
135
136
$body = $response->getBody();
137
138
try {
139
$result = json_decode($body);
140
- }
141
- catch (Exception $e) {
142
throw Mage::exception('Mage_Core', $e);
143
}
144
@@ -148,50 +137,46 @@ class Janrain_Engage_Helper_Rpxcall extends Mage_Core_Helper_Abstract {
148
else {
149
throw Mage::exception('Mage_Core', "something went wrong");
150
}
151
-
152
- }
153
- catch (Exception $e) {
154
throw Mage::exception('Mage_Core', $e);
155
}
156
-
157
}
158
159
- public function getFirstName($auth_info) {
160
- if (isset($auth_info->profile->name->givenName))
161
- return $auth_info->profile->name->givenName;
162
-
163
if (!isset($auth_info->profile->name->formatted))
164
return '';
165
166
- $name = str_replace(",", "", $auth_info->profile->name->formatted);
167
168
if (!$name)
169
return '';
170
-
171
$split = explode(" ", $name);
172
173
- $fName = isset($split[0]) ? $split[0] : '';
174
- return $fName;
175
- }
176
177
- public function getLastName($auth_info) {
178
- if (isset($auth_info->profile->name->familyName))
179
- return $auth_info->profile->name->familyName;
180
-
181
if (!isset($auth_info->profile->name->formatted))
182
return '';
183
184
- $name = str_replace(",", "", $auth_info->profile->name->formatted);
185
-
186
if (!$name)
187
return '';
188
-
189
- $split = explode(" ", $name);
190
- $key = sizeof($split) - 1;
191
192
- $lName = isset($split[$key]) ? $split[$key] : '';
193
- return $lName;
194
- }
195
196
}
197
- ?>
2
3
class Janrain_Engage_Helper_Rpxcall extends Mage_Core_Helper_Abstract {
4
5
+ public function getEngageApiKey() {
6
+ return Mage::getStoreConfig('engage/options/apikey');
7
+ }
8
+
9
+ public function rpxLookupSave() {
10
+ try {
11
+ $lookup_rp = $this->rpxLookupRpCall();
12
+
13
+ Mage::getModel('core/config')
14
+ ->saveConfig('engage/vars/realm', $lookup_rp->realm)
15
+ ->saveConfig('engage/vars/realmscheme', $lookup_rp->realmScheme)
16
+ ->saveConfig('engage/vars/appid', $lookup_rp->appId)
17
+ ->saveConfig('engage/vars/adminurl', $lookup_rp->adminUrl)
18
+ ->saveConfig('engage/vars/socialpub', $lookup_rp->socialPub)
19
+ ->saveConfig('engage/vars/enabled_providers', $lookup_rp->signinProviders)
20
+ ->saveConfig('engage/vars/apikey', Mage::getStoreConfig('engage/options/apikey'));
21
+ Mage::getConfig()->reinit();
22
+
23
+ return true;
24
+ } catch (Exception $e) {
25
+ Mage::getSingleton('adminhtml/session')->addWarning('Could not retrieve account info. Please try again');
26
+ }
27
+
28
+ return false;
29
+ }
30
31
public function rpxLookupRpCall() {
32
$version = Mage::getConfig()->getModuleConfig("Janrain_Engage")->version;
39
$result = "rpxLookupRpCall: no result";
40
try {
41
$result = $this->rpxPost("lookup_rp", $postParams);
42
+ } catch (Exception $e) {
43
throw Mage::exception('Mage_Core', $e);
44
}
45
46
return $result;
47
}
48
+
49
public function rpxAuthInfoCall($token) {
50
51
$postParams = array();
56
$result = "rpxAuthInfoCall: no result";
57
try {
58
$result = $this->rpxPost("auth_info", $postParams);
59
+ } catch (Exception $e) {
60
throw Mage::exception('Mage_Core', $e);
61
}
62
63
return $result;
64
}
65
66
public function rpxActivityCall($identifier, $activity_message, $url) {
67
68
$postParams = array();
69
+ $activity = new stdClass();
70
71
+ $activity->action = $activity_message;
72
+ $activity->url = $url;
73
+
74
+ $activity_json = json_encode($activity);
75
76
$postParams["activity"] = $activity_json;
77
$postParams["identifier"] = $identifier;
80
$result = "rpxActivityCall: no result";
81
try {
82
$result = $this->rpxPost("activity", $postParams);
83
+ } catch (Exception $e) {
84
throw Mage::exception('Mage_Core', $e);
85
}
86
87
return $result;
88
}
89
90
private function rpxPost($method, $postParams) {
91
92
$rpxbase = "https://rpxnow.com";
103
else {
104
throw Mage::exception('Mage_Core', "method [$method] not understood");
105
}
106
+
107
+ $url = "$rpxbase/$method_fragment";
108
+ $method = 'POST';
109
$postParams["format"] = 'json';
110
111
return $this->rpxCall($url, $method, $postParams);
112
}
113
114
+ private function rpxCall($url, $method = 'GET', $postParams = null) {
115
116
$result = "rpxCallUrl: no result yet";
117
118
try {
119
120
$http = new Varien_Http_Client($url);
121
+ $http->setHeaders(array("Accept-encoding" => "identity"));
122
+ if ($method == 'POST')
123
+ $http->setParameterPost($postParams);
124
$response = $http->request($method);
125
126
$body = $response->getBody();
127
128
try {
129
$result = json_decode($body);
130
+ } catch (Exception $e) {
131
throw Mage::exception('Mage_Core', $e);
132
}
133
137
else {
138
throw Mage::exception('Mage_Core', "something went wrong");
139
}
140
+ } catch (Exception $e) {
141
throw Mage::exception('Mage_Core', $e);
142
}
143
}
144
145
+ public function getFirstName($auth_info) {
146
+ if (isset($auth_info->profile->name->givenName))
147
+ return $auth_info->profile->name->givenName;
148
+
149
if (!isset($auth_info->profile->name->formatted))
150
return '';
151
152
+ $name = str_replace(",", "", $auth_info->profile->name->formatted);
153
154
if (!$name)
155
return '';
156
+
157
$split = explode(" ", $name);
158
159
+ $fName = isset($split[0]) ? $split[0] : '';
160
+ return $fName;
161
+ }
162
+
163
+ public function getLastName($auth_info) {
164
+ if (isset($auth_info->profile->name->familyName))
165
+ return $auth_info->profile->name->familyName;
166
167
if (!isset($auth_info->profile->name->formatted))
168
return '';
169
170
+ $name = str_replace(",", "", $auth_info->profile->name->formatted);
171
+
172
if (!$name)
173
return '';
174
175
+ $split = explode(" ", $name);
176
+ $key = sizeof($split) - 1;
177
+
178
+ $lName = isset($split[$key]) ? $split[$key] : '';
179
+ return $lName;
180
+ }
181
182
}
app/code/local/Janrain/Engage/Model/Customer.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- class Janrain_Engage_Model_Customer extends Mage_Customer_Model_Customer {
4
-
5
- /**
6
- * Validate password with salted hash
7
- *
8
- * @param string $password
9
- * @return boolean
10
- */
11
- public function validatePassword($password)
12
- {
13
- // TODO Make a more secure method of bypassing password (PSE-27)
14
- if(Mage::getSingleton('engage/session')->getLoginRequest()===true){
15
- Mage::getSingleton('engage/session')->setLoginRequest(false);
16
- return true;
17
- }
18
- return parent::validatePassword($password);
19
- }
20
-
21
- }
app/code/local/Janrain/Engage/Model/Identifiers.php CHANGED
@@ -2,8 +2,8 @@
2
3
class Janrain_Engage_Model_Identifiers extends Mage_Core_Model_Abstract {
4
5
- protected function _construct() {
6
- $this->_init('engage/identifiers');
7
- }
8
9
- }
2
3
class Janrain_Engage_Model_Identifiers extends Mage_Core_Model_Abstract {
4
5
+ protected function _construct() {
6
+ $this->_init('engage/identifiers');
7
+ }
8
9
+ }
app/code/local/Janrain/Engage/Model/Mysql4/Identifiers.php CHANGED
@@ -2,8 +2,8 @@
2
3
class Janrain_Engage_Model_Mysql4_Identifiers extends Mage_Core_Model_Mysql4_Abstract {
4
5
- protected function _construct() {
6
- $this->_init('engage/identifiers', 'engage_identifier_id');
7
- }
8
9
- }
2
3
class Janrain_Engage_Model_Mysql4_Identifiers extends Mage_Core_Model_Mysql4_Abstract {
4
5
+ protected function _construct() {
6
+ $this->_init('engage/identifiers', 'engage_identifier_id');
7
+ }
8
9
+ }
app/code/local/Janrain/Engage/Model/Mysql4/Identifiers/Collection.php CHANGED
@@ -1,7 +1,9 @@
1
<?php
2
3
class Janrain_Engage_Model_Mysql4_Identifiers_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
4
- protected function _construct() {
5
- $this->_init('engage/identifiers');
6
- }
7
- }
1
<?php
2
3
class Janrain_Engage_Model_Mysql4_Identifiers_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
4
+
5
+ protected function _construct() {
6
+ $this->_init('engage/identifiers');
7
+ }
8
+
9
+ }
app/code/local/Janrain/Engage/Model/Observer.php CHANGED
@@ -2,18 +2,18 @@
2
3
class Janrain_Engage_Model_Observer {
4
5
- public function addIdentifier($observer) {
6
- if($profile = Mage::getSingleton('engage/session')->getIdentifier()) {
7
- Mage::helper('engage/identifiers')
8
- ->save_identifier($observer->getCustomer()->getId(), $profile);
9
- Mage::getSingleton('engage/session')->setIdentifier(false);
10
- }
11
- }
12
13
- public function onConfigSave($observer) {
14
- if(Mage::getStoreConfig('engage/vars/apikey') != Mage::getStoreConfig('engage/options/apikey') || strlen(Mage::getStoreConfig('engage/vars/appid'))<1){
15
- Mage::helper('engage/rpxcall')->rpxLookupSave();
16
- }
17
- }
18
19
- }
2
3
class Janrain_Engage_Model_Observer {
4
5
+ public function addIdentifier($observer) {
6
+ if ($profile = Mage::getSingleton('engage/session')->getIdentifier()) {
7
+ Mage::helper('engage/identifiers')
8
+ ->save_identifier($observer->getCustomer()->getId(), $profile);
9
+ Mage::getSingleton('engage/session')->setIdentifier(false);
10
+ }
11
+ }
12
13
+ public function onConfigSave($observer) {
14
+ if (Mage::getStoreConfig('engage/vars/apikey') != Mage::getStoreConfig('engage/options/apikey') || strlen(Mage::getStoreConfig('engage/vars/appid')) < 1) {
15
+ Mage::helper('engage/rpxcall')->rpxLookupSave();
16
+ }
17
+ }
18
19
+ }
app/code/local/Janrain/Engage/Model/Resource/Eav/Mysql4/Setup.php CHANGED
@@ -1,5 +1,5 @@
1
<?php
2
3
class Janrain_Engage_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup {
4
-
5
- }
1
<?php
2
3
class Janrain_Engage_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup {
4
+
5
+ }
app/code/local/Janrain/Engage/Model/Session.php CHANGED
@@ -2,34 +2,12 @@
2
3
class Janrain_Engage_Model_Session extends Mage_Core_Model_Session_Abstract {
4
5
- const ENGAGE_ALLOWED_LOGIN_METHODS = 'validatePassword,authenticateAction';
6
- const ENGAGE_ALLOWED_CLASS_PREFIX = 'Janrain_Engage';
7
8
- public function __construct() {
9
- $namespace = 'engage';
10
- $namespace .= '_' . (Mage::app()->getStore()->getWebsite()->getCode());
11
12
- $this->init($namespace);
13
- Mage::dispatchEvent('engage_session_init', array('engage_session' => $this));
14
- }
15
-
16
- public function setLoginRequest($value) {
17
-
18
- /**
19
- * Added security measure. Test whether the setLoginRequest session var
20
- * is being set from within this module or from another.
21
- *
22
- */
23
-
24
- $allowed_methods = explode(',', self::ENGAGE_ALLOWED_LOGIN_METHODS);
25
- $trace = debug_backtrace();
26
-
27
- if(isset($trace[1]['class']) && strpos($trace[1]['class'], self::ENGAGE_ALLOWED_CLASS_PREFIX) == 0 && in_array($trace[1]['function'], $allowed_methods))
28
- $this->setData("login_request", $value);
29
- else
30
- Mage::throwException('Method request not allowed');
31
-
32
- return $this;
33
- }
34
-
35
- }
2
3
class Janrain_Engage_Model_Session extends Mage_Core_Model_Session_Abstract {
4
5
+ public function __construct() {
6
+ $namespace = 'engage';
7
+ $namespace .= '_' . (Mage::app()->getStore()->getWebsite()->getCode());
8
9
+ $this->init($namespace);
10
+ Mage::dispatchEvent('engage_session_init', array('engage_session' => $this));
11
+ }
12
13
+ }
app/code/local/Janrain/Engage/controllers/Adminhtml/LookupController.php CHANGED
@@ -2,12 +2,12 @@
2
3
class Janrain_Engage_Adminhtml_LookupController extends Mage_Adminhtml_Controller_action {
4
5
- public function rpAction() {
6
- if(Mage::helper('engage/rpxcall')->rpxLookupSave())
7
- Mage::getSingleton('core/session')->addSuccess('Engage account data successfully retrieved');
8
- else
9
- Mage::getSingleton('core/session')->addError('Engage account data could not be updated');
10
- $this->_redirect('adminhtml/system_config/edit/section/engage');
11
- }
12
13
- }
2
3
class Janrain_Engage_Adminhtml_LookupController extends Mage_Adminhtml_Controller_action {
4
5
+ public function rpAction() {
6
+ if (Mage::helper('engage/rpxcall')->rpxLookupSave())
7
+ Mage::getSingleton('core/session')->addSuccess('Engage account data successfully retrieved');
8
+ else
9
+ Mage::getSingleton('core/session')->addError('Engage account data could not be updated');
10
+ $this->_redirect('adminhtml/system_config/edit/section/engage');
11
+ }
12
13
+ }
app/code/local/Janrain/Engage/controllers/IndexController.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
-
3
- class Janrain_Engage_IndexController extends Mage_Core_Controller_Front_Action {
4
-
5
- public function _construct() {
6
- // Change to the default store so we
7
- // can grab the frontend user session
8
- //Mage::app()->setCurrentStore('default');
9
-
10
- // Get the customer session
11
- //$this->_session = Mage::getSingleton('customer/session');
12
- }
13
-
14
- public function indexAction() {
15
-
16
- // $rpdata = Mage::helper('engage/rpxcall')->rpxLookupRpCall();
17
- // var_dump($rpdata);
18
- // echo($rpdata);
19
-
20
- $rp_moredata = Mage::helper('engage/rpxcall')->rpxUiConfigCall();
21
- // $rp_moredata = "test";
22
- echo($rp_moredata);
23
-
24
- }
25
-
26
-
27
- }
app/code/local/Janrain/Engage/controllers/RpxController.php CHANGED
@@ -1,24 +1,23 @@
1
<?php
2
3
- require_once("Mage/Customer/controllers/AccountController.php");
4
5
class Janrain_Engage_RpxController extends Mage_Customer_AccountController {
6
7
- /**
8
* Action predispatch
9
*
10
* Check customer authentication for some actions
11
- *
12
- * This is a clone of the one in Mage_Customer_AccountController
13
- * with two added action names to the preg_match regex to prevent
14
- * redirects back to customer/account/login when using Engage
15
- * authentication links. Rather than calling parent::preDispatch()
16
- * we explicitly call Mage_Core_Controller_Front_Action to prevent the
17
- * original preg_match test from breaking our auth process.
18
- *
19
*/
20
- public function preDispatch()
21
- {
22
// a brute-force protection here would be nice
23
24
Mage_Core_Controller_Front_Action::preDispatch();
@@ -28,218 +27,218 @@ class Janrain_Engage_RpxController extends Mage_Customer_AccountController {
28
}
29
30
$action = $this->getRequest()->getActionName();
31
- if (!preg_match('/^(addIdentifier|token_url_add|token_url|authenticate|duplicate|create|login|logoutSuccess|forgotpassword|forgotpasswordpost|confirm|confirmation)/i', $action)) {
32
if (!$this->_getSession()->authenticate($this)) {
33
$this->setFlag('', 'no-dispatch', true);
34
}
35
- } else {
36
$this->_getSession()->setNoReferer(true);
37
}
38
}
39
40
- public function indexAction() {
41
- $this->_redirect('customer/account/index');
42
- }
43
-
44
- /**
45
- * RPX Callback
46
- */
47
- public function token_urlAction() {
48
- $session = $this->_getSession();
49
-
50
- // Redirect if user is already authenticated
51
- if ($session->isLoggedIn()) {
52
- $this->_redirect('customer/account');
53
- return;
54
- }
55
-
56
- if ($this->getRequest()->isPost()) {
57
- $token = $this->getRequest()->getPost('token');
58
-
59
- if($token){
60
- // Store token in session under random key
61
- $key = Mage::helper('engage')->rand_str(12);
62
- Mage::getSingleton('engage/session')->setData($key, $token);
63
-
64
- // Redirect user to $this->authAction method passing $key as ses
65
- // $_GET variable (Magento style)
66
- $this->_redirect("janrain-engage/rpx/authenticate", array("ses" => $key));
67
- return;
68
- } else {
69
- $session->addError('Authentication token not received. Please try again.');
70
- }
71
- }
72
-
73
- $this->_redirect('customer/account/login');
74
- }
75
-
76
- /**
77
- * RPX Callback for Additional Identifiers
78
- */
79
- public function token_url_addAction(){
80
- $session = $this->_getSession();
81
-
82
- // Redirect if user isn't already authenticated
83
- if (!$session->isLoggedIn()) {
84
- $this->_redirect('customer/account/login');
85
- return;
86
- }
87
-
88
- if ($this->getRequest()->isPost()) {
89
- $token = $this->getRequest()->getPost('token');
90
-
91
- // Store token in session under random key
92
- $key = Mage::helper('engage')->rand_str(12);
93
- Mage::getSingleton('engage/session')->setData($key, $token);
94
-
95
- // Redirect user to $this->authAction method passing $key as ses
96
- // $_GET variable (Magento style)
97
- $this->_redirect("janrain-engage/rpx/addidentifier", array("ses" => $key));
98
- }
99
- }
100
-
101
- public function authenticateAction() {
102
- $session = $this->_getSession();
103
-
104
- $key = $this->getRequest()->getParam('ses');
105
- $token = Mage::getSingleton('engage/session')->getData($key);
106
- $auth_info = Mage::helper('engage/rpxcall')->rpxAuthInfoCall($token);
107
- if(isset($auth_info->stat) && $auth_info->stat=='ok') {
108
- $customer = Mage::helper('engage/identifiers')->get_customer($auth_info->profile->identifier);
109
-
110
- if ($customer === false) {
111
- $this->loadLayout();
112
- $block = Mage::getSingleton('core/layout')->getBlock('customer_form_register');
113
- if($block !== false) {
114
- $form_data = $block->getFormData();
115
-
116
- if(isset($auth_info->profile) && isset($auth_info->profile->verifiedEmail))
117
- $email = $auth_info->profile->verifiedEmail;
118
- else if(isset($auth_info->profile) && isset($auth_info->profile->email))
119
- $email = $auth_info->profile->email;
120
- else
121
- $email = '';
122
-
123
- $firstName = Mage::helper('engage/rpxcall')->getFirstName($auth_info);
124
- $lastName = Mage::helper('engage/rpxcall')->getLastName($auth_info);
125
-
126
- $form_data->setEmail($email);
127
- $form_data->setFirstname($firstName);
128
- $form_data->setLastname($lastName);
129
- }
130
- $profile = Mage::helper('engage')->buildProfile($auth_info);
131
- Mage::getSingleton('engage/session')->setIdentifier($profile);
132
-
133
- $this->renderLayout();
134
- return;
135
- } else {
136
- Mage::getSingleton('engage/session')->setLoginRequest(true);
137
- $session->login($customer->getEmail(), 'REQUIRED_SECOND_PARAM');
138
- $this->_loginPostRedirect();
139
- }
140
- } else {
141
- $session->addWarning('Could not retrieve account info. Please try again.');
142
- $this->_redirect('customer/account/login');
143
- }
144
- }
145
-
146
- public function addIdentifierAction() {
147
- $session = $this->_getSession();
148
-
149
- $key = $this->getRequest()->getParam('ses');
150
- $token = Mage::getSingleton('engage/session')->getData($key);
151
- $auth_info = Mage::helper('engage/rpxcall')->rpxAuthInfoCall($token);
152
-
153
- $customer = Mage::helper('engage/identifiers')->get_customer($auth_info->profile->identifier);
154
-
155
- if ($customer===false) {
156
- $customer_id = $session->getCustomer()->getId();
157
- $profile = Mage::helper('engage')->buildProfile($auth_info);
158
-
159
- Mage::helper('engage/identifiers')
160
- ->save_identifier($customer_id, $profile);
161
-
162
- $session->addSuccess('New provider successfully added.');
163
-
164
- } else {
165
- $session->addWarning('Could not add Provider. This account is already associated with a user.');
166
- }
167
-
168
- $this->_redirect('customer/account');
169
- }
170
-
171
- public function createPostAction() {
172
- $session = $this->_getSession();
173
- parent::createPostAction();
174
-
175
- $messages = $session->getMessages();
176
- $isError = false;
177
-
178
- foreach ($messages->getItems() as $message) {
179
- if ($message->getType() == 'error') {
180
- $isError = true;
181
- }
182
- }
183
-
184
- if ($isError) {
185
- $email = $this->getRequest()->getPost('email');
186
- $firstname = $this->getRequest()->getPost('firstname');
187
- $lastname = $this->getRequest()->getPost('lastname');
188
- Mage::getSingleton('engage/session')
189
- ->setEmail($email)
190
- ->setFirstname($firstname)
191
- ->setLastname($lastname);
192
- $this->_redirect('engage/rpx/duplicate');
193
- }
194
-
195
- return;
196
- }
197
-
198
- public function duplicateAction() {
199
- $session = $this->_getSession();
200
-
201
- // Redirect if user is already authenticated
202
- if ($session->isLoggedIn()) {
203
- $this->_redirect('customer/account');
204
- return;
205
- }
206
-
207
- $this->loadLayout();
208
- $this->_initLayoutMessages('customer/session');
209
- $block = Mage::getSingleton('core/layout')->getBlock('customer_form_register');
210
- $block->setUsername(Mage::getSingleton('engage/session')->getEmail());
211
- $block->getFormData()->setEmail(Mage::getSingleton('engage/session')->getEmail());
212
- $block->getFormData()->setFirstname(Mage::getSingleton('engage/session')->getFirstname());
213
- $block->getFormData()->setLastname(Mage::getSingleton('engage/session')->getLastname());
214
- $this->renderLayout();
215
- }
216
-
217
- public function loginPostAction() {
218
- parent::loginPostAction();
219
- }
220
-
221
- protected function _loginPostRedirect() {
222
- $session = $this->_getSession();
223
- if ($session->isLoggedIn()) {
224
- if ($profile = Mage::getSingleton('engage/session')->getIdentifier()) {
225
- $customer = $session->getCustomer();
226
- Mage::helper('engage/identifiers')
227
- ->save_identifier($customer->getId(), $profile);
228
- Mage::getSingleton('engage/session')->setIdentifier(false);
229
- }
230
- }
231
-
232
- parent::_loginPostRedirect();
233
- }
234
-
235
- public function removeIdAction() {
236
- $session = $this->_getSession();
237
- $id = $this->getRequest()->getParam('identifier');
238
-
239
- Mage::helper('engage/identifiers')
240
- ->delete_identifier($id);
241
- $session->addSuccess('Provider removed');
242
- $this->_redirect('customer/account');
243
- }
244
-
245
- }
1
<?php
2
3
+ require_once ('Mage/Customer/controllers/AccountController.php');
4
5
class Janrain_Engage_RpxController extends Mage_Customer_AccountController {
6
7
+ /**
8
* Action predispatch
9
*
10
* Check customer authentication for some actions
11
+ *
12
+ * This is a clone of the one in Mage_Customer_AccountController
13
+ * with two added action names to the preg_match regex to prevent
14
+ * redirects back to customer/account/login when using Engage
15
+ * authentication links. Rather than calling parent::preDispatch()
16
+ * we explicitly call Mage_Core_Controller_Front_Action to prevent the
17
+ * original preg_match test from breaking our auth process.
18
+ *
19
*/
20
+ public function preDispatch() {
21
// a brute-force protection here would be nice
22
23
Mage_Core_Controller_Front_Action::preDispatch();
27
}
28
29
$action = $this->getRequest()->getActionName();
30
+ if (!preg_match('/^(xdcomm|addIdentifier|token_url_add|token_url|authenticate|duplicate|create|login|logoutSuccess|forgotpassword|forgotpasswordpost|confirm|confirmation)/i', $action)) {
31
if (!$this->_getSession()->authenticate($this)) {
32
$this->setFlag('', 'no-dispatch', true);
33
}
34
+ }
35
+ else {
36
$this->_getSession()->setNoReferer(true);
37
}
38
}
39
40
+ public function indexAction() {
41
+ $this->_redirect('customer/account/index');
42
+ }
43
+
44
+ /**
45
+ * RPX Callback
46
+ */
47
+ public function token_urlAction() {
48
+ $session = $this->_getSession();
49
+
50
+ // Redirect if user is already authenticated
51
+ if ($session->isLoggedIn()) {
52
+ $this->_redirect('customer/account');
53
+ return;
54
+ }
55
+
56
+ if ($this->getRequest()->isPost()) {
57
+ $token = $this->getRequest()->getPost('token');
58
+
59
+ if ($token) {
60
+ // Store token in session under random key
61
+ $key = Mage::helper('engage')->rand_str(12);
62
+ Mage::getSingleton('engage/session')->setData($key, $token);
63
+
64
+ // Redirect user to $this->authAction method passing $key as ses
65
+ // $_GET variable (Magento style)
66
+ $this->_redirect("janrain-engage/rpx/authenticate", array("ses" => $key));
67
+ return;
68
+ }
69
+ else {
70
+ $session->addError('Authentication token not received. Please try again.');
71
+ }
72
+ }
73
+
74
+ $this->_redirect('customer/account/login');
75
+ }
76
+
77
+ /**
78
+ * RPX Callback for Additional Identifiers
79
+ */
80
+ public function token_url_addAction() {
81
+ $session = $this->_getSession();
82
+
83
+ // Redirect if user isn't already authenticated
84
+ if (!$session->isLoggedIn()) {
85
+ $this->_redirect('customer/account/login');
86
+ return;
87
+ }
88
+
89
+ if ($this->getRequest()->isPost()) {
90
+ $token = $this->getRequest()->getPost('token');
91
+
92
+ // Store token in session under random key
93
+ $key = Mage::helper('engage')->rand_str(12);
94
+ Mage::getSingleton('engage/session')->setData($key, $token);
95
+
96
+ // Redirect user to $this->authAction method passing $key as ses
97
+ // $_GET variable (Magento style)
98
+ $this->_redirect("janrain-engage/rpx/addidentifier", array("ses" => $key));
99
+ }
100
+ }
101
+
102
+ public function authenticateAction() {
103
+ $session = $this->_getSession();
104
+
105
+ $key = $this->getRequest()->getParam('ses');
106
+ $token = Mage::getSingleton('engage/session')->getData($key);
107
+ $auth_info = Mage::helper('engage/rpxcall')->rpxAuthInfoCall($token);
108
+ if (isset($auth_info->stat) && $auth_info->stat == 'ok') {
109
+ $customer = Mage::helper('engage/identifiers')->get_customer($auth_info->profile->identifier);
110
+
111
+ if ($customer === false) {
112
+ $this->loadLayout();
113
+ $block = Mage::getSingleton('core/layout')->getBlock('customer_form_register');
114
+ if ($block !== false) {
115
+ $form_data = $block->getFormData();
116
+
117
+ if (isset($auth_info->profile) && isset($auth_info->profile->verifiedEmail))
118
+ $email = $auth_info->profile->verifiedEmail;
119
+ else if (isset($auth_info->profile) && isset($auth_info->profile->email))
120
+ $email = $auth_info->profile->email;
121
+ else
122
+ $email = '';
123
+
124
+ $firstName = Mage::helper('engage/rpxcall')->getFirstName($auth_info);
125
+ $lastName = Mage::helper('engage/rpxcall')->getLastName($auth_info);
126
+
127
+ $form_data->setEmail($email);
128
+ $form_data->setFirstname($firstName);
129
+ $form_data->setLastname($lastName);
130
+ }
131
+ $profile = Mage::helper('engage')->buildProfile($auth_info);
132
+ Mage::getSingleton('engage/session')->setIdentifier($profile);
133
+
134
+ $this->renderLayout();
135
+ return;
136
+ } else {
137
+ Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
138
+ $this->_loginPostRedirect();
139
+ }
140
+ }
141
+ else {
142
+ $session->addWarning('Could not retrieve account info. Please try again.');
143
+ $this->_redirect('customer/account/login');
144
+ }
145
+ }
146
+
147
+ public function addIdentifierAction() {
148
+ $session = $this->_getSession();
149
+
150
+ $key = $this->getRequest()->getParam('ses');
151
+ $token = Mage::getSingleton('engage/session')->getData($key);
152
+ $auth_info = Mage::helper('engage/rpxcall')->rpxAuthInfoCall($token);
153
+
154
+ $customer = Mage::helper('engage/identifiers')->get_customer($auth_info->profile->identifier);
155
+
156
+ if ($customer === false) {
157
+ $customer_id = $session->getCustomer()->getId();
158
+ $profile = Mage::helper('engage')->buildProfile($auth_info);
159
+
160
+ Mage::helper('engage/identifiers')->save_identifier($customer_id, $profile);
161
+
162
+ $session->addSuccess('New provider successfully added.');
163
+ }
164
+ else {
165
+ $session->addWarning('Could not add Provider. This account is already associated with a user.');
166
+ }
167
+
168
+ $this->_redirect('customer/account');
169
+ }
170
+
171
+ public function createPostAction() {
172
+ $session = $this->_getSession();
173
+ parent::createPostAction();
174
+
175
+ $messages = $session->getMessages();
176
+ $isError = false;
177
+
178
+ foreach ($messages->getItems() as $message) {
179
+ if ($message->getType() == 'error') {
180
+ $isError = true;
181
+ }
182
+ }
183
+
184
+ if ($isError) {
185
+ $email = $this->getRequest()->getPost('email');
186
+ $firstname = $this->getRequest()->getPost('firstname');
187
+ $lastname = $this->getRequest()->getPost('lastname');
188
+ Mage::getSingleton('engage/session')->setEmail($email)->setFirstname($firstname)->setLastname($lastname);
189
+ $this->_redirect('engage/rpx/duplicate');
190
+ }
191
+
192
+ return;
193
+ }
194
+
195
+ public function duplicateAction() {
196
+ $session = $this->_getSession();
197
+
198
+ // Redirect if user is already authenticated
199
+ if ($session->isLoggedIn()) {
200
+ $this->_redirect('customer/account');
201
+ return;
202
+ }
203
+
204
+ $this->loadLayout();
205
+ $this->_initLayoutMessages('customer/session');
206
+ $block = Mage::getSingleton('core/layout')->getBlock('customer_form_register');
207
+ $block->setUsername(Mage::getSingleton('engage/session')->getEmail());
208
+ $block->getFormData()->setEmail(Mage::getSingleton('engage/session')->getEmail());
209
+ $block->getFormData()->setFirstname(Mage::getSingleton('engage/session')->getFirstname());
210
+ $block->getFormData()->setLastname(Mage::getSingleton('engage/session')->getLastname());
211
+ $this->renderLayout();
212
+ }
213
+
214
+ public function loginPostAction() {
215
+ parent::loginPostAction();
216
+ }
217
+
218
+ protected function _loginPostRedirect() {
219
+ $session = $this->_getSession();
220
+ if ($session->isLoggedIn()) {
221
+ if ($profile = Mage::getSingleton('engage/session')->getIdentifier()) {
222
+ $customer = $session->getCustomer();
223
+ Mage::helper('engage/identifiers')->save_identifier($customer->getId(), $profile);
224
+ Mage::getSingleton('engage/session')->setIdentifier(false);
225
+ }
226
+ }
227
+
228
+ parent::_loginPostRedirect();
229
+ }
230
+
231
+ public function removeIdAction() {
232
+ $session = $this->_getSession();
233
+ $id = $this->getRequest()->getParam('identifier');
234
+
235
+ Mage::helper('engage/identifiers')->delete_identifier($id);
236
+ $session->addSuccess('Provider removed');
237
+ $this->_redirect('customer/account');
238
+ }
239
+
240
+ public function xdcommAction() {
241
+ $this->getResponse()->setBody($this->getLayout()->createBlock('engage/xdcomm')->toHtml());
242
+ }
243
+
244
+ }
app/code/local/Janrain/Engage/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
<config>
4
<modules>
5
<Janrain_Engage>
6
- <version>1.1.0</version>
7
</Janrain_Engage>
8
</modules>
9
<frontend>
@@ -23,15 +23,15 @@
23
</Janrain_Engage>
24
</modules>
25
</translate>
26
- <routers>
27
- <engage>
28
- <use>standard</use>
29
- <args>
30
- <module>Janrain_Engage</module>
31
- <frontName>janrain-engage</frontName>
32
- </args>
33
- </engage>
34
- </routers>
35
</frontend>
36
37
<global>
@@ -43,42 +43,37 @@
43
<models>
44
<engage>
45
<class>Janrain_Engage_Model</class>
46
- <resourceModel>engage_mysql4</resourceModel>
47
</engage>
48
- <customer>
49
- <rewrite>
50
- <customer>Janrain_Engage_Model_Customer</customer>
51
- </rewrite>
52
- </customer>
53
- <engage_mysql4>
54
- <class>Janrain_Engage_Model_Mysql4</class>
55
- <entities>
56
- <identifiers>
57
- <table>engage_identifiers</table>
58
- </identifiers>
59
- </entities>
60
- </engage_mysql4>
61
</models>
62
- <events>
63
- <customer_save_after>
64
- <observers>
65
- <add_engage_identifier>
66
- <type>singleton</type>
67
- <class>Janrain_Engage_Model_Observer</class>
68
- <method>addIdentifier</method>
69
- </add_engage_identifier>
70
- </observers>
71
- </customer_save_after>
72
- <admin_system_config_changed_section_engage>
73
- <observers>
74
- <engage_config_save>
75
- <type>singleton</type>
76
- <class>Janrain_Engage_Model_Observer</class>
77
- <method>onConfigSave</method>
78
- </engage_config_save>
79
- </observers>
80
- </admin_system_config_changed_section_engage>
81
- </events>
82
<helpers>
83
<engage>
84
<class>Janrain_Engage_Helper</class>
@@ -88,7 +83,7 @@
88
<engage_setup>
89
<setup>
90
<module>Janrain_Engage</module>
91
- <class>Janrain_Engage_Model_Resource_Eav_Mysql4_Setup</class>
92
</setup>
93
<connection>
94
<use>core_setup</use>
@@ -107,7 +102,7 @@
107
</resources>
108
</global>
109
110
- <admin>
111
<routers>
112
<engage>
113
<use>admin</use>
@@ -154,18 +149,18 @@
154
<options>
155
<apikey></apikey>
156
<enable>1</enable>
157
- <path_skin>{{base_skin}}/frontend/janrain</path_skin>
158
</options>
159
160
<!-- Set values of global config vars -->
161
- <vars>
162
- <realm></realm>
163
- <realmscheme></realmscheme>
164
- <appid></appid>
165
- <adminurl></adminurl>
166
- <socialpub></socialpub>
167
- <enabled_providers></enabled_providers>
168
- </vars>
169
</engage>
170
</default>
171
3
<config>
4
<modules>
5
<Janrain_Engage>
6
+ <version>1.1.1</version>
7
</Janrain_Engage>
8
</modules>
9
<frontend>
23
</Janrain_Engage>
24
</modules>
25
</translate>
26
+ <routers>
27
+ <engage>
28
+ <use>standard</use>
29
+ <args>
30
+ <module>Janrain_Engage</module>
31
+ <frontName>janrain-engage</frontName>
32
+ </args>
33
+ </engage>
34
+ </routers>
35
</frontend>
36
37
<global>
43
<models>
44
<engage>
45
<class>Janrain_Engage_Model</class>
46
+ <resourceModel>engage_mysql4</resourceModel>
47
</engage>
48
+ <engage_mysql4>
49
+ <class>Janrain_Engage_Model_Mysql4</class>
50
+ <entities>
51
+ <identifiers>
52
+ <table>engage_identifiers</table>
53
+ </identifiers>
54
+ </entities>
55
+ </engage_mysql4>
56
</models>
57
+ <events>
58
+ <customer_save_after>
59
+ <observers>
60
+ <add_engage_identifier>
61
+ <type>singleton</type>
62
+ <class>Janrain_Engage_Model_Observer</class>
63
+ <method>addIdentifier</method>
64
+ </add_engage_identifier>
65
+ </observers>
66
+ </customer_save_after>
67
+ <admin_system_config_changed_section_engage>
68
+ <observers>
69
+ <engage_config_save>
70
+ <type>singleton</type>
71
+ <class>Janrain_Engage_Model_Observer</class>
72
+ <method>onConfigSave</method>
73
+ </engage_config_save>
74
+ </observers>
75
+ </admin_system_config_changed_section_engage>
76
+ </events>
77
<helpers>
78
<engage>
79
<class>Janrain_Engage_Helper</class>
83
<engage_setup>
84
<setup>
85
<module>Janrain_Engage</module>
86
+ <class>Janrain_Engage_Model_Resource_Eav_Mysql4_Setup</class>
87
</setup>
88
<connection>
89
<use>core_setup</use>
102
</resources>
103
</global>
104
105
+ <admin>
106
<routers>
107
<engage>
108
<use>admin</use>
149
<options>
150
<apikey></apikey>
151
<enable>1</enable>
152
+ <path_skin>{{base_skin}}/frontend/janrain</path_skin>
153
</options>
154
155
<!-- Set values of global config vars -->
156
+ <vars>
157
+ <realm></realm>
158
+ <realmscheme></realmscheme>
159
+ <appid></appid>
160
+ <adminurl></adminurl>
161
+ <socialpub></socialpub>
162
+ <enabled_providers></enabled_providers>
163
+ </vars>
164
</engage>
165
</default>
166
app/code/local/Janrain/Engage/etc/system.xml CHANGED
@@ -36,7 +36,8 @@
36
<apikey translate="label">
37
<label>Engage API key</label>
38
<frontend_type>text</frontend_type>
39
- <comment><![CDATA[Please enter your Engage API key.<br />Don't have one? <a href="http://www.janrain.com/products/engage/get-janrain-engage" target="_blank">Sign up here.</a>]]></comment>
40
<sort_order>60</sort_order>
41
<show_in_default>1</show_in_default>
42
<show_in_website>1</show_in_website>
@@ -44,7 +45,7 @@
44
</apikey>
45
</fields>
46
</options>
47
- <accountdata translate="label">
48
<label>Account Info</label>
49
<frontend_type>text</frontend_type>
50
<frontend_model>engage/accountdata</frontend_model>
@@ -64,15 +65,15 @@
64
</info>
65
66
<!-- Frame global uneditable config variables -->
67
- <vars translate="label">
68
- <label>Global Variables</label>
69
- <frontend_type>text</frontend_type>
70
- <sort_order>50</sort_order>
71
- <show_in_default>0</show_in_default>
72
- <show_in_website>0</show_in_website>
73
- <show_in_store>0</show_in_store>
74
- <fields>
75
- <realm translate="label">
76
<label>Realm</label>
77
<frontend_type>text</frontend_type>
78
<sort_order>62</sort_order>
@@ -80,7 +81,7 @@
80
<show_in_website>0</show_in_website>
81
<show_in_store>0</show_in_store>
82
</realm>
83
- <realmscheme translate="label">
84
<label>Realm Scheme</label>
85
<frontend_type>text</frontend_type>
86
<sort_order>63</sort_order>
@@ -88,7 +89,7 @@
88
<show_in_website>0</show_in_website>
89
<show_in_store>0</show_in_store>
90
</realmscheme>
91
- <appid translate="label">
92
<label>App Id</label>
93
<frontend_type>text</frontend_type>
94
<sort_order>64</sort_order>
@@ -96,7 +97,7 @@
96
<show_in_website>0</show_in_website>
97
<show_in_store>0</show_in_store>
98
</appid>
99
- <adminurl translate="label">
100
<label>Admin Url</label>
101
<frontend_type>text</frontend_type>
102
<sort_order>65</sort_order>
@@ -104,7 +105,7 @@
104
<show_in_website>0</show_in_website>
105
<show_in_store>0</show_in_store>
106
</adminurl>
107
- <socialpub translate="label">
108
<label>Social Pub</label>
109
<frontend_type>text</frontend_type>
110
<sort_order>66</sort_order>
@@ -112,7 +113,7 @@
112
<show_in_website>0</show_in_website>
113
<show_in_store>0</show_in_store>
114
</socialpub>
115
- <enabled_providers translate="label">
116
<label>Enabled Providers</label>
117
<frontend_type>text</frontend_type>
118
<sort_order>67</sort_order>
@@ -120,7 +121,7 @@
120
<show_in_website>0</show_in_website>
121
<show_in_store>0</show_in_store>
122
</enabled_providers>
123
- <apikey translate="label">
124
<label>Engage API key</label>
125
<frontend_type>text</frontend_type>
126
<sort_order>68</sort_order>
@@ -128,8 +129,8 @@
128
<show_in_website>0</show_in_website>
129
<show_in_store>0</show_in_store>
130
</apikey>
131
- </fields>
132
- </vars>
133
</groups>
134
</engage>
135
</sections>
36
<apikey translate="label">
37
<label>Engage API key</label>
38
<frontend_type>text</frontend_type>
39
+ <comment><![CDATA[Please enter your Engage API key.<br />Don't have one? <a href="http://www.janrain.com/products/engage/get-janrain-engage" target="_blank">Sign up here.</a>]]>
40
+ </comment>
41
<sort_order>60</sort_order>
42
<show_in_default>1</show_in_default>
43
<show_in_website>1</show_in_website>
45
</apikey>
46
</fields>
47
</options>
48
+ <accountdata translate="label">
49
<label>Account Info</label>
50
<frontend_type>text</frontend_type>
51
<frontend_model>engage/accountdata</frontend_model>
65
</info>
66
67
<!-- Frame global uneditable config variables -->
68
+ <vars translate="label">
69
+ <label>Global Variables</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>50</sort_order>
72
+ <show_in_default>0</show_in_default>
73
+ <show_in_website>0</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ <fields>
76
+ <realm translate="label">
77
<label>Realm</label>
78
<frontend_type>text</frontend_type>
79
<sort_order>62</sort_order>
81
<show_in_website>0</show_in_website>
82
<show_in_store>0</show_in_store>
83
</realm>
84
+ <realmscheme translate="label">
85
<label>Realm Scheme</label>
86
<frontend_type>text</frontend_type>
87
<sort_order>63</sort_order>
89
<show_in_website>0</show_in_website>
90
<show_in_store>0</show_in_store>
91
</realmscheme>
92
+ <appid translate="label">
93
<label>App Id</label>
94
<frontend_type>text</frontend_type>
95
<sort_order>64</sort_order>
97
<show_in_website>0</show_in_website>
98
<show_in_store>0</show_in_store>
99
</appid>
100
+ <adminurl translate="label">
101
<label>Admin Url</label>
102
<frontend_type>text</frontend_type>
103
<sort_order>65</sort_order>
105
<show_in_website>0</show_in_website>
106
<show_in_store>0</show_in_store>
107
</adminurl>
108
+ <socialpub translate="label">
109
<label>Social Pub</label>
110
<frontend_type>text</frontend_type>
111
<sort_order>66</sort_order>
113
<show_in_website>0</show_in_website>
114
<show_in_store>0</show_in_store>
115
</socialpub>
116
+ <enabled_providers translate="label">
117
<label>Enabled Providers</label>
118
<frontend_type>text</frontend_type>
119
<sort_order>67</sort_order>
121
<show_in_website>0</show_in_website>
122
<show_in_store>0</show_in_store>
123
</enabled_providers>
124
+ <apikey translate="label">
125
<label>Engage API key</label>
126
<frontend_type>text</frontend_type>
127
<sort_order>68</sort_order>
129
<show_in_website>0</show_in_website>
130
<show_in_store>0</show_in_store>
131
</apikey>
132
+ </fields>
133
+ </vars>
134
</groups>
135
</engage>
136
</sections>
app/code/local/Janrain/Engage/etc/widget.xml CHANGED
@@ -1,50 +1,50 @@
1
<?xml version="1.0"?>
2
<widgets>
3
- <engage_auth type="engage/auth" translate="name description" module="engage">
4
- <name>Janrain Engage Login</name>
5
- <description type="desc">Adds a link to open the Engage authentication dialog</description>
6
- <parameters>
7
- <label_text>
8
- <required>0</required>
9
- <visible>1</visible>
10
- <label>Label Text</label>
11
- <description>The text to display before Provider Icons. Defaults to 'Or log in with'</description>
12
- <type>text</type>
13
- </label_text>
14
- <size>
15
- <required>0</required>
16
- <visible>1</visible>
17
- <label>Widget Style</label>
18
- <type>select</type>
19
- <value>large</value>
20
- <values>
21
- <default translate="label">
22
- <value>large</value>
23
- <label>Large Icons</label>
24
- </default>
25
- <small translate="label">
26
- <value>small</value>
27
- <label>Small Icons</label>
28
- </small>
29
<inline translate="label">
30
- <value>inline</value>
31
- <label>Inline</label>
32
- </inline>
33
- </values>
34
- </size>
35
- </parameters>
36
- </engage_auth>
37
- <engage_share type="engage/share" translate="name description" module="engage">
38
- <name>Janrain Engage Social Sharing</name>
39
- <description type="desc">Adds a links to share content via Engage</description>
40
- <parameters>
41
- <share_text>
42
- <required>0</required>
43
- <visible>1</visible>
44
- <label>Share Text</label>
45
- <description>The default text to share in the Social Sharing widget (i.e. Check this out!)</description>
46
- <type>text</type>
47
- </share_text>
48
- </parameters>
49
- </engage_share>
50
</widgets>
1
<?xml version="1.0"?>
2
<widgets>
3
+ <engage_auth type="engage/auth" translate="name description" module="engage">
4
+ <name>Janrain Engage Login</name>
5
+ <description type="desc">Adds a link to open the Engage authentication dialog</description>
6
+ <parameters>
7
+ <label_text>
8
+ <required>0</required>
9
+ <visible>1</visible>
10
+ <label>Label Text</label>
11
+ <description>The text to display before Provider Icons. Defaults to 'Or log in with'</description>
12
+ <type>text</type>
13
+ </label_text>
14
+ <size>
15
+ <required>0</required>
16
+ <visible>1</visible>
17
+ <label>Widget Style</label>
18
+ <type>select</type>
19
+ <value>large</value>
20
+ <values>
21
+ <default translate="label">
22
+ <value>large</value>
23
+ <label>Large Icons</label>
24
+ </default>
25
+ <small translate="label">
26
+ <value>small</value>
27
+ <label>Small Icons</label>
28
+ </small>
29
<inline translate="label">
30
+ <value>inline</value>
31
+ <label>Inline</label>
32
+ </inline>
33
+ </values>
34
+ </size>
35
+ </parameters>
36
+ </engage_auth>
37
+ <engage_share type="engage/share" translate="name description" module="engage">
38
+ <name>Janrain Engage Social Sharing</name>
39
+ <description type="desc">Adds a links to share content via Engage</description>
40
+ <parameters>
41
+ <share_text>
42
+ <required>0</required>
43
+ <visible>1</visible>
44
+ <label>Share Text</label>
45
+ <description>The default text to share in the Social Sharing widget (i.e. Check this out!)</description>
46
+ <type>text</type>
47
+ </share_text>
48
+ </parameters>
49
+ </engage_share>
50
</widgets>
app/code/local/Janrain/Engage/sql/engage_setup/{mysql4-install-1.1.0.php → mysql4-install-1.1.1.php} RENAMED
File without changes
app/design/frontend/base/default/layout/engage.xml CHANGED
@@ -2,75 +2,75 @@
2
3
<layout version="0.1.0">
4
<!-- Load style on every page. This will be fixed later. -->
5
- <default>
6
- <reference name="head">
7
- <block type="core/template"
8
name="janrain_engage_styles"
9
template="janrain/engage/styles.phtml"/>
10
- </reference>
11
- </default>
12
13
<!-- Use our own register.phtml with no password fields and custom action -->
14
- <engage_rpx_authenticate>
15
- <label>Customer Account Registration Form</label>
16
<!-- Mage_Customer -->
17
- <remove name="right"/>
18
- <remove name="left"/>
19
20
- <reference name="root">
21
- <action method="setTemplate">
22
- <template>page/1column.phtml</template>
23
- </action>
24
- </reference>
25
- <reference name="content">
26
- <block type="customer/form_register" name="customer_form_register" template="janrain/engage/register.phtml">
27
- <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
28
- <label>Form Fields Before</label>
29
- </block>
30
- </block>
31
- </reference>
32
- </engage_rpx_authenticate>
33
34
<!-- Ask users what they want to do when they enter an existing customer email address -->
35
- <engage_rpx_duplicate>
36
- <label>Customer Account Registration Form</label>
37
<!-- Mage_Customer -->
38
- <remove name="right"/>
39
- <remove name="left"/>
40
41
- <reference name="root">
42
- <action method="setTemplate">
43
- <template>page/1column.phtml</template>
44
- </action>
45
- </reference>
46
- <reference name="content">
47
- <block type="customer/form_register" name="customer_form_register" template="janrain/engage/duplicate.phtml">
48
- <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
49
- <label>Form Fields Before</label>
50
- </block>
51
- </block>
52
- </reference>
53
- </engage_rpx_duplicate>
54
55
<!-- Customer Dashboard block -->
56
- <customer_account_index>
57
<!-- Scripts/Styles -->
58
- <reference name="before_body_end">
59
- <block type="core/template"
60
name="janrain_engage_scripts"
61
template="janrain/engage/scripts.phtml"/>
62
- </reference>
63
- <reference name="head">
64
- <block type="core/template"
65
name="janrain_engage_styles"
66
template="janrain/engage/styles.phtml"/>
67
- </reference>
68
69
- <reference name="content">
70
- <block type="core/template"
71
name="janrain_engage_dashboard"
72
after="-"
73
template="janrain/engage/dashboard.phtml"/>
74
- </reference>
75
- </customer_account_index>
76
</layout>
2
3
<layout version="0.1.0">
4
<!-- Load style on every page. This will be fixed later. -->
5
+ <default>
6
+ <reference name="head">
7
+ <block type="core/template"
8
name="janrain_engage_styles"
9
template="janrain/engage/styles.phtml"/>
10
+ </reference>
11
+ </default>
12
13
<!-- Use our own register.phtml with no password fields and custom action -->
14
+ <engage_rpx_authenticate>
15
+ <label>Customer Account Registration Form</label>
16
<!-- Mage_Customer -->
17
+ <remove name="right"/>
18
+ <remove name="left"/>
19
20
+ <reference name="root">
21
+ <action method="setTemplate">
22
+ <template>page/1column.phtml</template>
23
+ </action>
24
+ </reference>
25
+ <reference name="content">
26
+ <block type="customer/form_register" name="customer_form_register" template="janrain/engage/register.phtml">
27
+ <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
28
+ <label>Form Fields Before</label>
29
+ </block>
30
+ </block>
31
+ </reference>
32
+ </engage_rpx_authenticate>
33
34
<!-- Ask users what they want to do when they enter an existing customer email address -->
35
+ <engage_rpx_duplicate>
36
+ <label>Customer Account Registration Form</label>
37
<!-- Mage_Customer -->
38
+ <remove name="right"/>
39
+ <remove name="left"/>
40
41
+ <reference name="root">
42
+ <action method="setTemplate">
43
+ <template>page/1column.phtml</template>
44
+ </action>
45
+ </reference>
46
+ <reference name="content">
47
+ <block type="customer/form_register" name="customer_form_register" template="janrain/engage/duplicate.phtml">
48
+ <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
49
+ <label>Form Fields Before</label>
50
+ </block>
51
+ </block>
52
+ </reference>
53
+ </engage_rpx_duplicate>
54
55
<!-- Customer Dashboard block -->
56
+ <customer_account_index>
57
<!-- Scripts/Styles -->
58
+ <reference name="before_body_end">
59
+ <block type="core/template"
60
name="janrain_engage_scripts"
61
template="janrain/engage/scripts.phtml"/>
62
+ </reference>
63
+ <reference name="head">
64
+ <block type="core/template"
65
name="janrain_engage_styles"
66
template="janrain/engage/styles.phtml"/>
67
+ </reference>
68
69
+ <reference name="content">
70
+ <block type="core/template"
71
name="janrain_engage_dashboard"
72
after="-"
73
template="janrain/engage/dashboard.phtml"/>
74
+ </reference>
75
+ </customer_account_index>
76
</layout>
app/design/frontend/base/default/template/janrain/engage/dashboard.phtml CHANGED
@@ -1,63 +1,62 @@
1
<div class="dashboard">
2
- <div class="box-account box-info">
3
- <div class="box-head">
4
- <h2>Janrain Engage</h2>
5
- </div>
6
- <div class="col2-set">
7
- <div class="col-1">
8
- <div class="box">
9
- <div class="box-title">
10
- <h3>Identities</h3>
11
- </div>
12
- <div class="box-content">
13
- <ul>
14
- <?php
15
- $identifiers = Mage::helper('engage/identifiers')->get_identifiers(
16
- Mage::getSingleton('customer/session')->getCustomer()->getId()
17
- );
18
19
- foreach($identifiers as &$identifier) {
20
- echo '<li style="clear:both;"><div class="rpx_icon_small rpx_'
21
- . $identifier->getProvider()
22
- . '_small"></div><span class="rpx_profile_label">'
23
- . $identifier->getProfileName()
24
- . ' <small>(<a href="'
25
- . Mage::getUrl('engage/rpx/removeid', array('identifier' => $identifier->getId()))
26
- . '">remove</a>)</small></span></li>';
27
- }
28
29
- ?>
30
- </ul>
31
- </div>
32
- </div>
33
- </div>
34
- <div class="col-2">
35
- <div class="box">
36
- <div class="box-title">
37
- <h3>Add Identity</h3>
38
- </div>
39
- <div class="box-content">
40
- <?php
41
- $providers = Mage::helper('engage')->getRpxProviders();
42
- if (is_array($providers)) {
43
- $size = "30";
44
- $wrap_open = '<a class="rpxnow rpx_link_wrap" onclick="return false;" href="'
45
- . Mage::helper('engage')->getRpxAuthUrl(true)
46
- . '">';
47
- $wrap_close = '</a>';
48
49
- $rpx_buttons = '';
50
- foreach ($providers as $val) {
51
- $rpx_buttons .= '<div class="jn-icon jn-size' . $size . ' jn-' . $val . '" title="' . htmlentities($val) . '"></div>';
52
- }
53
- $buttons = '<div class="rpx_button">' . $rpx_buttons . '</div><div class="rpx_clear"></div>';
54
-
55
- echo $wrap_open . $buttons . $wrap_close;
56
- }
57
- ?>
58
- </div>
59
- </div>
60
- </div>
61
- </div>
62
- </div>
63
</div>
1
<div class="dashboard">
2
+ <div class="box-account box-info">
3
+ <div class="box-head">
4
+ <h2>Janrain Engage</h2>
5
+ </div>
6
+ <div class="col2-set">
7
+ <div class="col-1">
8
+ <div class="box">
9
+ <div class="box-title">
10
+ <h3>Identities</h3>
11
+ </div>
12
+ <div class="box-content">
13
+ <ul>
14
+ <?php
15
+ $identifiers = Mage::helper('engage/identifiers')->get_identifiers(
16
+ Mage::getSingleton('customer/session')->getCustomer()->getId()
17
+ );
18
19
+ foreach ($identifiers as &$identifier) {
20
+ echo '<li style="clear:both;"><div class="rpx_icon_small rpx_'
21
+ . $identifier->getProvider()
22
+ . '_small"></div><span class="rpx_profile_label">'
23
+ . $identifier->getProfileName()
24
+ . ' <small>(<a href="'
25
+ . Mage::getUrl('engage/rpx/removeid', array('identifier' => $identifier->getId()))
26
+ . '">remove</a>)</small></span></li>';
27
+ }
28
+ ?>
29
+ </ul>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ <div class="col-2">
34
+ <div class="box">
35
+ <div class="box-title">
36
+ <h3>Add Identity</h3>
37
+ </div>
38
+ <div class="box-content">
39
+ <?php
40
+ $providers = Mage::helper('engage')->getRpxProviders();
41
+ if (is_array($providers)) {
42
+ $size = "30";
43
+ $wrap_open = '<a class="rpxnow rpx_link_wrap" onclick="return false;" href="'
44
+ . Mage::helper('engage')->getRpxAuthUrl(true)
45
+ . '">';
46
+ $wrap_close = '</a>';
47
48
+ $rpx_buttons = '';
49
+ foreach ($providers as $val) {
50
+ $rpx_buttons .= '<div class="jn-icon jn-size' . $size . ' jn-' . $val . '" title="' . htmlentities($val) . '"></div>';
51
+ }
52
+ $buttons = '<div class="rpx_button">' . $rpx_buttons . '</div><div class="rpx_clear"></div>';
53
54
+ echo $wrap_open . $buttons . $wrap_close;
55
+ }
56
+ ?>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
</div>
app/design/frontend/base/default/template/janrain/engage/duplicate.phtml CHANGED
@@ -11,77 +11,77 @@
11
<h1><?php echo $this->__('Already have an account?') ?></h1>
12
</div>
13
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
14
- <div class="col2-set">
15
- <form action="<?php echo Mage::getUrl('engage/rpx/loginpost') ?>" method="post" id="login-form">
16
- <div class="col-1 registered-users">
17
- <div class="content">
18
- <h2><?php echo $this->__('Use an Existing Account') ?></h2>
19
- <p><?php echo $this->__('Enter your password to be able to log in using this provider in the future.') ?></p>
20
- <ul class="form-list">
21
- <li>
22
- <label><?php echo $this->__('Email Address') ?></label>
23
- <div class="input-box">
24
- <strong><em><?php echo $this->htmlEscape($this->getUsername()) ?></em></strong>
25
- </div>
26
- </li>
27
- <li>
28
- <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
29
- <div class="input-box">
30
- <input type="hidden" 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') ?>" />
31
- <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
32
- </div>
33
- </li>
34
- </ul>
35
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
36
- </div>
37
- <div class="buttons-set">
38
- <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
39
- <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
40
- </div>
41
- </div>
42
- </form>
43
- <form action="<?php echo Mage::getUrl('engage/rpx/createpost'); ?>" method="post" id="form-validate">
44
- <div class="col-2 new-users">
45
- <div class="content">
46
- <h2><?php echo $this->__('Try Again') ?></h2>
47
- <p><?php echo $this->__('If you would like to try another email address, please use the form below.') ?></p>
48
- <ul class="form-list">
49
- <li>
50
- <label for="firstname" class="required"><em>*</em><?php echo $this->__('First Name') ?></label>
51
- <div class="input-box">
52
- <input type="text" name="firstname" value="<?php echo $this->htmlEscape($this->getFormData()->getFirstname()) ?>" id="firstname" class="input-text required-entry" title="<?php echo $this->__('First Name') ?>" />
53
- </div>
54
- </li>
55
- <li>
56
- <label for="lastname" class="required"><em>*</em><?php echo $this->__('Last Name') ?></label>
57
- <div class="input-box">
58
- <input type="text" name="lastname" value="<?php echo $this->htmlEscape($this->getFormData()->getLastname()) ?>" id="lastname" class="input-text required-entry" title="<?php echo $this->__('Last Name') ?>" />
59
- </div>
60
- </li>
61
- <li>
62
- <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
63
- <div class="input-box">
64
- <input type="text" name="email" id="email_address" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
65
- <?php
66
- $password = md5('Janrain_Engage_' . Mage::helper('engage')->rand_str(12));
67
- ?>
68
- <input type="hidden" name="password" value="<?php echo $password; ?>" />
69
- <input type="hidden" name="confirmation" value="<?php echo $password; ?>" />
70
- <input type="hidden" name="success_url" value="<?php echo Mage::getSingleton('customer/session')->getBeforeAuthUrl(); ?>" />
71
- </div>
72
- </li>
73
- </ul>
74
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
75
- </div>
76
- <div class="buttons-set">
77
- <button type="submit" class="button" title="<?php echo $this->__('Submit') ?>" id="send"><span><span><?php echo $this->__('Submit') ?></span></span></button>
78
- </div>
79
- </div>
80
- </form>
81
- </div>
82
<script type="text/javascript">
83
- //<![CDATA[
84
var dataForm = new VarienForm('login-form', true);
85
- //]]>
86
</script>
87
</div>
11
<h1><?php echo $this->__('Already have an account?') ?></h1>
12
</div>
13
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
14
+ <div class="col2-set">
15
+ <form action="<?php echo Mage::getUrl('engage/rpx/loginpost') ?>" method="post" id="login-form">
16
+ <div class="col-1 registered-users">
17
+ <div class="content">
18
+ <h2><?php echo $this->__('Use an Existing Account') ?></h2>
19
+ <p><?php echo $this->__('Enter your password to be able to log in using this provider in the future.') ?></p>
20
+ <ul class="form-list">
21
+ <li>
22
+ <label><?php echo $this->__('Email Address') ?></label>
23
+ <div class="input-box">
24
+ <strong><em><?php echo $this->htmlEscape($this->getUsername()) ?></em></strong>
25
+ </div>
26
+ </li>
27
+ <li>
28
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
29
+ <div class="input-box">
30
+ <input type="hidden" 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') ?>" />
31
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
32
+ </div>
33
+ </li>
34
+ </ul>
35
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
36
+ </div>
37
+ <div class="buttons-set">
38
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
39
+ <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
40
+ </div>
41
+ </div>
42
+ </form>
43
+ <form action="<?php echo Mage::getUrl('engage/rpx/createpost'); ?>" method="post" id="form-validate">
44
+ <div class="col-2 new-users">
45
+ <div class="content">
46
+ <h2><?php echo $this->__('Try Again') ?></h2>
47
+ <p><?php echo $this->__('If you would like to try another email address, please use the form below.') ?></p>
48
+ <ul class="form-list">
49
+ <li>
50
+ <label for="firstname" class="required"><em>*</em><?php echo $this->__('First Name') ?></label>
51
+ <div class="input-box">
52
+ <input type="text" name="firstname" value="<?php echo $this->htmlEscape($this->getFormData()->getFirstname()) ?>" id="firstname" class="input-text required-entry" title="<?php echo $this->__('First Name') ?>" />
53
+ </div>
54
+ </li>
55
+ <li>
56
+ <label for="lastname" class="required"><em>*</em><?php echo $this->__('Last Name') ?></label>
57
+ <div class="input-box">
58
+ <input type="text" name="lastname" value="<?php echo $this->htmlEscape($this->getFormData()->getLastname()) ?>" id="lastname" class="input-text required-entry" title="<?php echo $this->__('Last Name') ?>" />
59
+ </div>
60
+ </li>
61
+ <li>
62
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
63
+ <div class="input-box">
64
+ <input type="text" name="email" id="email_address" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
65
+ <?php
66
+ $password = md5('Janrain_Engage_' . Mage::helper('engage')->rand_str(12));
67
+ ?>
68
+ <input type="hidden" name="password" value="<?php echo $password; ?>" />
69
+ <input type="hidden" name="confirmation" value="<?php echo $password; ?>" />
70
+ <input type="hidden" name="success_url" value="<?php echo Mage::getSingleton('customer/session')->getBeforeAuthUrl(); ?>" />
71
+ </div>
72
+ </li>
73
+ </ul>
74
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
75
+ </div>
76
+ <div class="buttons-set">
77
+ <button type="submit" class="button" title="<?php echo $this->__('Submit') ?>" id="send"><span><span><?php echo $this->__('Submit') ?></span></span></button>
78
+ </div>
79
+ </div>
80
+ </form>
81
+ </div>
82
<script type="text/javascript">
83
+ //<![CDATA[
84
var dataForm = new VarienForm('login-form', true);
85
+ //]]>
86
</script>
87
</div>
app/design/frontend/base/default/template/janrain/engage/register.phtml CHANGED
@@ -10,7 +10,7 @@
10
<div class="page-title">
11
<h1><?php echo $this->__('Create an Account') ?></h1>
12
</div>
13
- <?php echo $this->getChildHtml('form_fields_before')?>
14
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
15
<form action="<?php echo Mage::getUrl('engage/rpx/createpost'); ?>" method="post" id="form-validate">
16
<div class="fieldset">
@@ -27,107 +27,107 @@
27
</div>
28
</li>
29
<?php if ($this->isNewsletterEnabled()): ?>
30
- <li class="control">
31
- <div class="input-box">
32
- <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
33
- </div>
34
- <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
35
- </li>
36
<?php endif ?>
37
- <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
38
- <?php if ($_dob->isEnabled()): ?>
39
- <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
40
- <?php endif ?>
41
- <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
42
- <?php if ($_taxvat->isEnabled()): ?>
43
- <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
44
- <?php endif ?>
45
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
46
- <?php if ($_gender->isEnabled()): ?>
47
- <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
48
- <?php endif ?>
49
</ul>
50
</div>
51
- <?php if($this->getShowAddressFields()): ?>
52
- <div class="fieldset">
53
- <input type="hidden" name="create_address" value="1" />
54
- <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
55
- <ul class="form-list">
56
- <li class="fields">
57
- <div class="field">
58
- <label for="company"><?php echo $this->__('Company') ?></label>
59
- <div class="input-box">
60
- <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
61
</div>
62
- </div>
63
- <div class="field">
64
- <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
65
- <div class="input-box">
66
- <input type="text" name="telephone" id="telephone" value="<?php echo $this->htmlEscape($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" />
67