Icemax_AESocialLogin - Version 1.0.1

Version Notes

Initial Release for The Appreciation Engine Social Login 1.0.1

Download this release

Release Info

Developer Maxim Baybakov
Extension Icemax_AESocialLogin
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

Files changed (24) hide show
  1. app/code/community/Icemax/AESocialLogin/Block/Accountdata.php +55 -0
  2. app/code/community/Icemax/AESocialLogin/Block/Info.php +43 -0
  3. app/code/community/Icemax/AESocialLogin/Helper/Apicall.php +146 -0
  4. app/code/community/Icemax/AESocialLogin/Helper/Data.php +90 -0
  5. app/code/community/Icemax/AESocialLogin/Helper/Identifiers.php +168 -0
  6. app/code/community/Icemax/AESocialLogin/Model/Identifiers.php +28 -0
  7. app/code/community/Icemax/AESocialLogin/Model/Mysql4/Identifiers.php +28 -0
  8. app/code/community/Icemax/AESocialLogin/Model/Mysql4/Identifiers/Collection.php +28 -0
  9. app/code/community/Icemax/AESocialLogin/Model/Observer.php +44 -0
  10. app/code/community/Icemax/AESocialLogin/Model/Resource/Eav/Mysql4/Setup.php +24 -0
  11. app/code/community/Icemax/AESocialLogin/Model/Session.php +32 -0
  12. app/code/community/Icemax/AESocialLogin/Model/System/Config/Authwindow.php +34 -0
  13. app/code/community/Icemax/AESocialLogin/Model/System/Config/Sso.php +34 -0
  14. app/code/community/Icemax/AESocialLogin/controllers/Adminhtml/RefreshController.php +32 -0
  15. app/code/community/Icemax/AESocialLogin/controllers/ApiController.php +200 -0
  16. app/code/community/Icemax/AESocialLogin/etc/config.xml +158 -0
  17. app/code/community/Icemax/AESocialLogin/etc/system.xml +140 -0
  18. app/code/community/Icemax/AESocialLogin/sql/AESocialLogin_setup/mysql4-install-1.0.1.php +36 -0
  19. app/design/frontend/base/default/layout/icemax/aesociallogin.xml +49 -0
  20. app/design/frontend/base/default/template/icemax/aesociallogin/duplicate.phtml +87 -0
  21. app/design/frontend/base/default/template/icemax/aesociallogin/init.phtml +23 -0
  22. app/design/frontend/base/default/template/icemax/aesociallogin/register.phtml +145 -0
  23. app/etc/modules/Icemax_AESocialLogin.xml +8 -0
  24. package.xml +18 -0
app/code/community/Icemax/AESocialLogin/Block/Accountdata.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Block_Accountdata extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
23
+
24
+ public function render(Varien_Data_Form_Element_Abstract $element) {
25
+
26
+ $html = $this->_getHeaderHtml($element);
27
+
28
+ $html .= $this->_getFieldHtml($element);
29
+
30
+ $html .= $this->_getFooterHtml($element);
31
+
32
+ return $html;
33
+ }
34
+
35
+ protected function _getFieldHtml($fieldset) {
36
+
37
+ if (Mage::helper('aesociallogin')->isAESocialLoginEnabled() === false)
38
+ return '<p>Module not enabled. Please set "Enabled" to "Yes" and enter your API key above.</p>';
39
+
40
+ $content = '<p><a href="' . Mage::helper('adminhtml')->getUrl('aesocialloginadmin/adminhtml_refresh/refresh') . '">Click Here to refresh</a></p>';
41
+
42
+ $value = Mage::getStoreConfig('aesociallogin/vars/connection_info');
43
+ if ($value == 1) {
44
+ $content .= '<p>The API key is correct. Connection works good.</p>';
45
+ } else {
46
+ $content .= '<p>Something wrong with the connection.</p>';
47
+ if ($value) {
48
+ $content .= '<p>Error: '.$value.'</p>';
49
+ }
50
+ }
51
+
52
+ return $content;
53
+ }
54
+
55
+ }
app/code/community/Icemax/AESocialLogin/Block/Info.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Block_Info extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
23
+
24
+ public function render(Varien_Data_Form_Element_Abstract $element) {
25
+
26
+ $html = $this->_getHeaderHtml($element);
27
+
28
+ $html .= $this->_getFieldHtml($element);
29
+
30
+ $html .= $this->_getFooterHtml($element);
31
+
32
+ return $html;
33
+ }
34
+
35
+ protected function _getFieldHtml($fieldset) {
36
+ $content = '<p>The Appreciation Engine Social Login for Magento ' . Mage::getConfig()->getModuleConfig("Icemax_AESocialLogin")->version . '</p>';
37
+ $content.= '<p>The Appreication Engine website: <a href="http://theappreciationengine.com/" target="_blank">http://theappreciationengine.com/</a></p>';
38
+ $content.= '<p>The Extension developed by <a href="#">Icemax.</a></p>';
39
+
40
+ return $content;
41
+ }
42
+
43
+ }
app/code/community/Icemax/AESocialLogin/Helper/Apicall.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Helper_Apicall extends Mage_Core_Helper_Abstract {
23
+
24
+ public function getAESocialLoginApiKey() {
25
+ return Mage::getStoreConfig('aesociallogin/options/apikey');
26
+ }
27
+
28
+ public function getAESocialLoginEndpoint() {
29
+ return Mage::getStoreConfig('aesociallogin/options/endpoint');
30
+ }
31
+
32
+ public function apiRefreshSave() {
33
+ try {
34
+ $connection_info = false;
35
+
36
+ $api_rp = $this->apiLoginsCall();
37
+
38
+ if (is_array($api_rp) && !empty($api_rp[0]->ID)) {
39
+ $connection_info = 1;
40
+ }
41
+ if (!empty($api_rp->error->message)) {
42
+ $connection_info = $api_rp->error->message;
43
+ }
44
+
45
+ Mage::getModel('core/config')
46
+ ->saveConfig('aesociallogin/vars/connection_info', $connection_info)
47
+ ->saveConfig('aesociallogin/vars/apikey', Mage::getStoreConfig('aesociallogin/options/apikey'));
48
+ Mage::getConfig()->reinit();
49
+
50
+ return true;
51
+ } catch (Exception $e) {
52
+
53
+ Mage::getModel('core/config')
54
+ ->saveConfig('aesociallogin/vars/connection_info', $connection_info)
55
+ ->saveConfig('aesociallogin/vars/apikey', Mage::getStoreConfig('aesociallogin/options/apikey'));
56
+ Mage::getConfig()->reinit();
57
+
58
+ Mage::getSingleton('adminhtml/session')->addWarning('Could not retrieve account info. Please try again');
59
+ }
60
+
61
+ return false;
62
+ }
63
+
64
+ public function apiLoginsCall() {
65
+
66
+ $requestParams = array();
67
+ $requestParams["apiKey"] = $this->getAESocialLoginApiKey();
68
+
69
+ try {
70
+ $result = $this->apiCallInit("logins", $requestParams, 'GET');
71
+ } catch (Exception $e) {
72
+ throw Mage::exception('Mage_Core', $e);
73
+ }
74
+
75
+ return $result;
76
+ }
77
+
78
+ public function AuthCall($token) {
79
+
80
+ $requestParams = array();
81
+
82
+ $requestParams["accessToken"] = $token;
83
+ $requestParams["apiKey"] = $this->getAESocialLoginApiKey();
84
+ $requestParams["details"] = 1;
85
+
86
+ try {
87
+ $result = $this->apiCallInit("auth_info", $requestParams, 'POST');
88
+ } catch (Exception $e) {
89
+ throw Mage::exception('Mage_Core', $e);
90
+ }
91
+
92
+ return $result;
93
+ }
94
+
95
+ private function apiCallInit($api_method, $requestParams, $method = 'GET') {
96
+
97
+ $api_base = $this->getAESocialLoginEndpoint();
98
+
99
+ if ($api_method == "auth_info") {
100
+ $method_fragment = "api/auth";
101
+ }
102
+ elseif ($api_method == "logins") {
103
+ $method_fragment = "api/logins";
104
+ }
105
+ else {
106
+ throw Mage::exception('Mage_Core', "method [$method] not understood");
107
+ }
108
+
109
+ $url = "$api_base/$method_fragment";
110
+
111
+ return $this->apiCall($url, $method, $requestParams);
112
+ }
113
+
114
+ private function apiCall($url, $method = 'GET', $requestParams = null) {
115
+
116
+ try {
117
+
118
+ $http = new Varien_Http_Client($url);
119
+ $http->setAdapter(new Varien_Http_Adapter_Curl());
120
+ $http->setHeaders(array("Accept-encoding" => "identity"));
121
+ if ($method == 'POST')
122
+ $http->setParameterPost($requestParams);
123
+ if ($method == 'GET')
124
+ $http->setParameterGet($requestParams);
125
+ $response = $http->request($method);
126
+
127
+ $body = $response->getBody();
128
+ //print_r($body);print_r($url);print_r($response);print_r($method);die();
129
+ try {
130
+ $result = json_decode($body);
131
+ } catch (Exception $e) {
132
+ throw Mage::exception('Mage_Core', $e);
133
+ }
134
+
135
+ if ($result) {
136
+ return $result;
137
+ }
138
+ else {
139
+ throw Mage::exception('Mage_Core', "something went wrong");
140
+ }
141
+ } catch (Exception $e) {
142
+ throw Mage::exception('Mage_Core', $e);
143
+ }
144
+ }
145
+
146
+ }
app/code/community/Icemax/AESocialLogin/Helper/Data.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Helper_Data extends Mage_Core_Helper_Abstract {
23
+
24
+ /**
25
+ * Returns whether the Enabled config variable is set to true
26
+ *
27
+ * @return bool
28
+ */
29
+ public function isAESocialLoginEnabled() {
30
+ if (Mage::getStoreConfig('aesociallogin/options/enable') == '1' && strlen(Mage::getStoreConfig('aesociallogin/options/apikey')) > 0)
31
+ return true;
32
+
33
+ return false;
34
+ }
35
+
36
+ /**
37
+ * Returns random alphanumber string
38
+ *
39
+ * @param int $length
40
+ * @param string $chars
41
+ * @return string
42
+ */
43
+ public function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890') {
44
+ $chars_length = (strlen($chars) - 1);
45
+
46
+ $string = $chars{rand(0, $chars_length)};
47
+
48
+ for ($i = 1; $i < $length; $i = strlen($string)) {
49
+ $r = $chars{rand(0, $chars_length)};
50
+
51
+ if ($r != $string{$i - 1})
52
+ $string .= $r;
53
+ }
54
+
55
+ return $string;
56
+ }
57
+
58
+ /**
59
+ * Returns the url of skin directory containing scripts and styles
60
+ *
61
+ * @return string
62
+ */
63
+ public function _baseSkin() {
64
+ return Mage::getBaseUrl('skin') . "frontend/icemax";
65
+ }
66
+
67
+ /**
68
+ * Build profile array which contain information about current customer
69
+ *
70
+ * @param object $auth_info
71
+ * @return array
72
+ */
73
+ public function buildProfile($auth_info) {
74
+
75
+ if (!empty($auth_info->data->Username))
76
+ $profile_name = $auth_info->data->Username;
77
+
78
+ else if (!empty($auth_info->data->Email))
79
+ $profile_name = $auth_info->data->Email;
80
+
81
+ else
82
+ $profile_name = $auth_info->services[0]->Service;
83
+
84
+ return array('provider' => $auth_info->services[0]->Service,
85
+ 'identifier' => $auth_info->data->ID,
86
+ 'service_identifier' => $auth_info->services[0]->ID,
87
+ 'profile_name' => $profile_name
88
+ );
89
+ }
90
+ }
app/code/community/Icemax/AESocialLogin/Helper/Identifiers.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Helper_Identifiers extends Mage_Core_Helper_Abstract {
23
+
24
+ /**
25
+ * Assigns a new identifier to a customer
26
+ *
27
+ * @param int $customer_id
28
+ * @param string $identifier
29
+ */
30
+ public function save_identifier($customer_id, $profile) {
31
+
32
+ /**
33
+ * Make the save
34
+ *
35
+ */
36
+ try {
37
+ Mage::getModel('aesociallogin/identifiers')
38
+ ->setIdentifier($profile['identifier'])
39
+ ->setServiceIdentifier($profile['service_identifier'])
40
+ ->setProvider($profile['provider'])
41
+ ->setProfileName($profile['profile_name'])
42
+ ->setCustomerId($customer_id)
43
+ ->save();
44
+ } catch (Exception $e) {
45
+ echo "Could not save: " . $e->getMessage() . "\n";
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Gets a customer by identifier
51
+ *
52
+ * @param string $identifier
53
+ * @return Mage_Customer_Model_Customer
54
+ */
55
+ public function get_customer($identifier) {
56
+ $customer_id = Mage::getModel('aesociallogin/identifiers')
57
+ ->getCollection()
58
+ ->addFieldToFilter('identifier', $identifier)
59
+ ->getFirstItem();
60
+ $customer_id = $customer_id->getCustomerId();
61
+ if ((int) $customer_id > 0) {
62
+ $customer = Mage::getModel('customer/customer')
63
+ ->getCollection()
64
+ ->addFieldToFilter('entity_id', $customer_id)
65
+ ->getFirstItem();
66
+ return $customer;
67
+ }
68
+ return false;
69
+ }
70
+
71
+ /**
72
+ * Gets a customer by service identifier
73
+ *
74
+ * @param string $service_identifier
75
+ * @return Mage_Customer_Model_Customer
76
+ */
77
+ public function get_customer_by_service($service_identifier) {
78
+ $customer_id = Mage::getModel('aesociallogin/identifiers')
79
+ ->getCollection()
80
+ ->addFieldToFilter('service_identifier', $service_identifier)
81
+ ->getFirstItem();
82
+ $customer_id = $customer_id->getCustomerId();
83
+ if ((int) $customer_id > 0) {
84
+ $customer = Mage::getModel('customer/customer')
85
+ ->getCollection()
86
+ ->addFieldToFilter('entity_id', $customer_id)
87
+ ->getFirstItem();
88
+ return $customer;
89
+ }
90
+ return false;
91
+ }
92
+
93
+ /**
94
+ * Gets a customer by email
95
+ *
96
+ * @param string $email
97
+ * @return Mage_Customer_Model_Customer
98
+ */
99
+ public function get_customer_by_email($email) {
100
+
101
+ $customer = Mage::getModel('customer/customer')
102
+ ->getCollection()
103
+ ->addFieldToFilter('email', $email)
104
+ ->getFirstItem();
105
+ return $customer;
106
+ }
107
+
108
+ /**
109
+ * Gets an identifiers by customer ID
110
+ *
111
+ * @param string $customer_id
112
+ * @return Icemax_AESocialLogin_Model_Identifiers
113
+ */
114
+ public function get_identifiers($customer_id) {
115
+ if ((int) $customer_id > 0) {
116
+ $identifiers = Mage::getModel('aesociallogin/identifiers')
117
+ ->getCollection()
118
+ ->addFieldToFilter('customer_id', $customer_id);
119
+
120
+ return $identifiers;
121
+ }
122
+
123
+ return false;
124
+ }
125
+
126
+ /**
127
+ * Delete an identifier
128
+ *
129
+ * @param int $id
130
+ */
131
+ public function delete_identifier($id) {
132
+ $customer_id = Mage::getSingleton('customer/session')
133
+ ->getCustomer()
134
+ ->getId();
135
+
136
+ $identifier = Mage::getModel('aesociallogin/identifiers')
137
+ ->getCollection()
138
+ ->addFieldToFilter('appreciationengine_identifier_id', $id)
139
+ ->getFirstItem();
140
+ if ($identifier->getCustomerId() == $customer_id) {
141
+ try {
142
+ $identifier->delete();
143
+ } catch (Exception $e) {
144
+ echo "Could not delete: $e";
145
+ }
146
+ }
147
+ }
148
+
149
+ /**
150
+ * Delete all identifiers
151
+ *
152
+ * @param object $customer
153
+ */
154
+ public function delete_all_identifiers($customer) {
155
+ $customer_id = $customer->getId();
156
+ if ((int) $customer_id > 0) {
157
+ $identifiers = $this->get_identifiers($customer_id);
158
+ foreach ($identifiers as &$identifier) {
159
+ try {
160
+ $identifier->delete();
161
+ } catch (Exception $e) {
162
+ echo "Could not delete: $e";
163
+ }
164
+ }
165
+ }
166
+ }
167
+
168
+ }
app/code/community/Icemax/AESocialLogin/Model/Identifiers.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Model_Identifiers extends Mage_Core_Model_Abstract {
23
+
24
+ protected function _construct() {
25
+ $this->_init('aesociallogin/identifiers');
26
+ }
27
+
28
+ }
app/code/community/Icemax/AESocialLogin/Model/Mysql4/Identifiers.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Model_Mysql4_Identifiers extends Mage_Core_Model_Mysql4_Abstract {
23
+
24
+ protected function _construct() {
25
+ $this->_init('aesociallogin/identifiers', 'appreciationengine_identifier_id');
26
+ }
27
+
28
+ }
app/code/community/Icemax/AESocialLogin/Model/Mysql4/Identifiers/Collection.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Model_Mysql4_Identifiers_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
23
+
24
+ protected function _construct() {
25
+ $this->_init('aesociallogin/identifiers');
26
+ }
27
+
28
+ }
app/code/community/Icemax/AESocialLogin/Model/Observer.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Model_Observer {
23
+
24
+ public function addIdentifier($observer) {
25
+ if ($profile = Mage::getSingleton('aesociallogin/session')->getIdentifier()) {
26
+ Mage::helper('aesociallogin/identifiers')
27
+ ->save_identifier($observer->getCustomer()->getId(), $profile);
28
+ Mage::getSingleton('aesociallogin/session')->setIdentifier(false);
29
+ }
30
+ }
31
+
32
+ public function removeIdentifiers($observer) {
33
+ $event = $observer->getEvent();
34
+ $customer = $event->getCustomer();
35
+ Mage::helper('aesociallogin/identifiers')->delete_all_identifiers($customer);
36
+ }
37
+
38
+ public function onConfigSave($observer) {
39
+ if (Mage::getStoreConfig('aesociallogin/vars/apikey') != Mage::getStoreConfig('aesociallogin/options/apikey')) {
40
+ Mage::helper('aesociallogin/apicall')->apiRefreshSave();
41
+ }
42
+ }
43
+
44
+ }
app/code/community/Icemax/AESocialLogin/Model/Resource/Eav/Mysql4/Setup.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup {
23
+
24
+ }
app/code/community/Icemax/AESocialLogin/Model/Session.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Model_Session extends Mage_Core_Model_Session_Abstract {
23
+
24
+ public function __construct() {
25
+ $namespace = 'AESocialLogin';
26
+ $namespace .= '_' . (Mage::app()->getStore()->getWebsite()->getCode());
27
+
28
+ $this->init($namespace);
29
+ Mage::dispatchEvent('AESocialLogin_session_init', array('AESocialLogin_session' => $this));
30
+ }
31
+
32
+ }
app/code/community/Icemax/AESocialLogin/Model/System/Config/Authwindow.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Model_System_Config_Authwindow
23
+ {
24
+ public function toOptionArray()
25
+ {
26
+ $paramsArray = array(
27
+ 'true' => 'Modal window pop­up',
28
+ 'false' => 'Browser redirect',
29
+ );
30
+ return $paramsArray;
31
+ }
32
+ }
33
+
34
+ ?>
app/code/community/Icemax/AESocialLogin/Model/System/Config/Sso.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Model_System_Config_Sso
23
+ {
24
+ public function toOptionArray()
25
+ {
26
+ $paramsArray = array(
27
+ 'local' => 'Local',
28
+ 'application' => 'Application'
29
+ );
30
+ return $paramsArray;
31
+ }
32
+ }
33
+
34
+ ?>
app/code/community/Icemax/AESocialLogin/controllers/Adminhtml/RefreshController.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Icemax_AESocialLogin_Adminhtml_RefreshController extends Mage_Adminhtml_Controller_Action
23
+ {
24
+ public function refreshAction() {
25
+ if (Mage::helper('aesociallogin/apicall')->apiRefreshSave()) {
26
+ Mage::getSingleton('core/session')->addSuccess('AE account data successfully retrieved');
27
+ } else {
28
+ Mage::getSingleton('core/session')->addError('AE account data could not be updated');
29
+ }
30
+ $this->_redirect('adminhtml/system_config/edit/section/aesociallogin');
31
+ }
32
+ }
app/code/community/Icemax/AESocialLogin/controllers/ApiController.php ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ require_once ('Mage/Customer/controllers/AccountController.php');
23
+
24
+ class Icemax_AESocialLogin_ApiController extends Mage_Customer_AccountController {
25
+
26
+ /**
27
+ * Action predispatch
28
+ *
29
+ * Check customer authentication for some actions
30
+ *
31
+ * This is a clone of the one in Mage_Customer_AccountController
32
+ * with two added action names to the preg_match regex to prevent
33
+ * redirects back to customer/account/login when using AE
34
+ * authentication links. Rather than calling parent::preDispatch()
35
+ * we explicitly call Mage_Core_Controller_Front_Action to prevent the
36
+ * original preg_match test from breaking our auth process.
37
+ *
38
+ */
39
+ public function preDispatch() {
40
+ // a brute-force protection here would be nice
41
+
42
+ Mage_Core_Controller_Front_Action::preDispatch();
43
+
44
+ if (!$this->getRequest()->isDispatched()) {
45
+ return;
46
+ }
47
+
48
+ $action = $this->getRequest()->getActionName();
49
+ if (!preg_match('/^(xdcomm|login|duplicate|create|login|logoutSuccess|forgotpassword|forgotpasswordpost|confirm|confirmation)/i', $action)) {
50
+ if (!$this->_getSession()->authenticate($this)) {
51
+ $this->setFlag('', 'no-dispatch', true);
52
+ }
53
+ } else {
54
+ $this->_getSession()->setNoReferer(true);
55
+ }
56
+ }
57
+
58
+ public function indexAction() {
59
+ $this->_redirect('customer/account/index');
60
+ }
61
+
62
+ /**
63
+ * Login/Registation process
64
+ */
65
+ public function loginAction() {
66
+ $session = $this->_getSession();
67
+
68
+ // Redirect if user is already authenticated
69
+ if ($session->isLoggedIn()) {
70
+ $this->_redirect('customer/account');
71
+ return;
72
+ }
73
+
74
+ $token = $this->getRequest()->get('accessToken');
75
+ $auth_info = Mage::helper('aesociallogin/apicall')->AuthCall($token);
76
+
77
+ if (!empty($auth_info->data->ID)) {
78
+ $customer = Mage::helper('aesociallogin/identifiers')->get_customer_by_service($auth_info->services[0]->ID);
79
+
80
+ if ($customer === false) {
81
+ $customer = Mage::helper('aesociallogin/identifiers')->get_customer($auth_info->data->ID);
82
+
83
+ $email = !empty($auth_info->data->Email) ? $auth_info->data->Email : '';
84
+ $firstName = !empty($auth_info->data->FirstName) ? $auth_info->data->FirstName : '';
85
+ $lastName = !empty($auth_info->data->Surname) ? $auth_info->data->Surname : '';
86
+
87
+ if ($customer === false && $email) {
88
+ $customer = Mage::helper('aesociallogin/identifiers')->get_customer_by_email($email);
89
+ }
90
+
91
+ $profile = Mage::helper('aesociallogin')->buildProfile($auth_info);
92
+ Mage::getSingleton('aesociallogin/session')->setIdentifier($profile);
93
+ }
94
+
95
+ if ($customer === false) {
96
+
97
+ $isSeamless = ('1' == Mage::getStoreConfig('aesociallogin/options/seamless'));
98
+ if ($isSeamless && $email && $firstName && $lastName) {
99
+ $customer = Mage::getModel('customer/customer')->setId(null);
100
+ $customer->getGroupId();
101
+ $customer->setFirstname($firstName);
102
+ $customer->setLastname($lastName);
103
+ $customer->setEmail($email);
104
+
105
+ $password = md5('Icemax_AESocialLogin' . Mage::helper('aesociallogin')->rand_str(12));
106
+
107
+ $_SERVER['REQUEST_METHOD'] = 'POST';
108
+ $this->_request->setPost(array(
109
+ 'email' => $email,
110
+ 'password' => $password,
111
+ 'confirmation' => $password
112
+ ));
113
+ Mage::register('current_customer', $customer);
114
+
115
+ $this->_forward('createPost');
116
+ } else {
117
+ $this->loadLayout();
118
+ $block = Mage::getSingleton('core/layout')->getBlock('customer_form_register');
119
+ if ($block !== false) {
120
+ $form_data = $block->getFormData();
121
+
122
+ $form_data->setEmail($email);
123
+ $form_data->setFirstname($firstName);
124
+ $form_data->setLastname($lastName);
125
+ }
126
+
127
+ $this->renderLayout();
128
+ }
129
+ return;
130
+ } else {
131
+ Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
132
+ $this->_loginPostRedirect();
133
+ }
134
+ } else {
135
+ $session->addWarning('Could not retrieve account info. Please try again.');
136
+ $this->_redirect('customer/account/login');
137
+ }
138
+ }
139
+
140
+ public function createPostAction() {
141
+ $session = $this->_getSession();
142
+ parent::createPostAction();
143
+
144
+ $messages = $session->getMessages();
145
+ $isError = false;
146
+
147
+ foreach ($messages->getItems() as $message) {
148
+ if ($message->getType() == 'error') {
149
+ $isError = true;
150
+ }
151
+ }
152
+
153
+ if ($isError) {
154
+ $email = $this->getRequest()->getPost('email');
155
+ $firstname = $this->getRequest()->getPost('firstname');
156
+ $lastname = $this->getRequest()->getPost('lastname');
157
+ Mage::getSingleton('aesociallogin/session')->setEmail($email)->setFirstname($firstname)->setLastname($lastname);
158
+ $this->_redirect('aesociallogin/api/duplicate');
159
+ }
160
+
161
+ return;
162
+ }
163
+
164
+ public function duplicateAction() {
165
+ $session = $this->_getSession();
166
+
167
+ // Redirect if user is already authenticated
168
+ if ($session->isLoggedIn()) {
169
+ $this->_redirect('customer/account');
170
+ return;
171
+ }
172
+
173
+ $this->loadLayout();
174
+ $this->_initLayoutMessages('customer/session');
175
+ $block = Mage::getSingleton('core/layout')->getBlock('customer_form_register');
176
+ $block->setUsername(Mage::getSingleton('aesociallogin/session')->getEmail());
177
+ $block->getFormData()->setEmail(Mage::getSingleton('aesociallogin/session')->getEmail());
178
+ $block->getFormData()->setFirstname(Mage::getSingleton('aesociallogin/session')->getFirstname());
179
+ $block->getFormData()->setLastname(Mage::getSingleton('aesociallogin/session')->getLastname());
180
+ $this->renderLayout();
181
+ }
182
+
183
+ public function loginPostAction() {
184
+ parent::loginPostAction();
185
+ }
186
+
187
+ protected function _loginPostRedirect() {
188
+ $session = $this->_getSession();
189
+ if ($session->isLoggedIn()) {
190
+ if ($profile = Mage::getSingleton('aesociallogin/session')->getIdentifier()) {
191
+ $customer = $session->getCustomer();
192
+ Mage::helper('aesociallogin/identifiers')->save_identifier($customer->getId(), $profile);
193
+ Mage::getSingleton('aesociallogin/session')->setIdentifier(false);
194
+ }
195
+ }
196
+
197
+ parent::_loginPostRedirect();
198
+ }
199
+
200
+ }
app/code/community/Icemax/AESocialLogin/etc/config.xml ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Icemax_AESocialLogin>
5
+ <codePool>community</codePool>
6
+ <version>1.0.1</version>
7
+ </Icemax_AESocialLogin>
8
+ </modules>
9
+ <global>
10
+ <models>
11
+ <aesociallogin>
12
+ <class>Icemax_AESocialLogin_Model</class>
13
+ <resourceModel>aesociallogin_mysql4</resourceModel>
14
+ </aesociallogin>
15
+ <aesociallogin_mysql4>
16
+ <class>Icemax_AESocialLogin_Model_Mysql4</class>
17
+ <entities>
18
+ <identifiers>
19
+ <table>appreciationengine_identifiers</table>
20
+ </identifiers>
21
+ </entities>
22
+ </aesociallogin_mysql4>
23
+ </models>
24
+ <resources>
25
+ <aesociallogin_setup>
26
+ <setup>
27
+ <module>Icemax_AESocialLogin</module>
28
+ <class>Icemax_AESocialLogin_Model_Resource_Eav_Mysql4_Setup</class>
29
+ </setup>
30
+ <connection>
31
+ <use>core_setup</use>
32
+ </connection>
33
+ </aesociallogin_setup>
34
+ <aesociallogin_write>
35
+ <connection>
36
+ <use>core_write</use>
37
+ </connection>
38
+ </aesociallogin_write>
39
+ <aesociallogin_read>
40
+ <connection>
41
+ <use>core_read</use>
42
+ </connection>
43
+ </aesociallogin_read>
44
+ </resources>
45
+ <blocks>
46
+ <aesociallogin>
47
+ <class>Icemax_AESocialLogin_Block</class>
48
+ </aesociallogin>
49
+ </blocks>
50
+ <helpers>
51
+ <aesociallogin>
52
+ <class>Icemax_AESocialLogin_Helper</class>
53
+ </aesociallogin>
54
+ </helpers>
55
+ <events>
56
+ <customer_save_after>
57
+ <observers>
58
+ <add_aesociallogin_identifier>
59
+ <type>singleton</type>
60
+ <class>Icemax_AESocialLogin_Model_Observer</class>
61
+ <method>addIdentifier</method>
62
+ </add_aesociallogin_identifier>
63
+ </observers>
64
+ </customer_save_after>
65
+ <customer_delete_after>
66
+ <observers>
67
+ <remove_aesociallogin_identifiers>
68
+ <type>singleton</type>
69
+ <class>Icemax_AESocialLogin_Model_Observer</class>
70
+ <method>removeIdentifiers</method>
71
+ </remove_aesociallogin_identifiers>
72
+ </observers>
73
+ </customer_delete_after>
74
+ <admin_system_config_changed_section_aesociallogin>
75
+ <observers>
76
+ <aesociallogin_config_save>
77
+ <type>singleton</type>
78
+ <class>Icemax_AESocialLogin_Model_Observer</class>
79
+ <method>onConfigSave</method>
80
+ </aesociallogin_config_save>
81
+ </observers>
82
+ </admin_system_config_changed_section_aesociallogin>
83
+ </events>
84
+ </global>
85
+
86
+ <admin>
87
+ <routers>
88
+ <aesocialloginadmin>
89
+ <use>admin</use>
90
+ <args>
91
+ <module>Icemax_AESocialLogin</module>
92
+ <frontName>icemax-aesociallogin-admin</frontName>
93
+ </args>
94
+ </aesocialloginadmin>
95
+ </routers>
96
+ </admin>
97
+
98
+ <adminhtml>
99
+ <acl>
100
+ <resources>
101
+ <admin>
102
+ <children>
103
+ <system>
104
+ <children>
105
+ <config>
106
+ <children>
107
+ <aesociallogin translate="title" module="aesociallogin">
108
+ <title>aesociallogin</title>
109
+ </aesociallogin>
110
+ </children>
111
+ </config>
112
+ </children>
113
+ </system>
114
+ </children>
115
+ </admin>
116
+ </resources>
117
+ </acl>
118
+ </adminhtml>
119
+
120
+ <frontend>
121
+ <secure_url>
122
+ <aesociallogin>/icemax-aesociallogin/api/</aesociallogin>
123
+ </secure_url>
124
+ <layout>
125
+ <updates>
126
+ <aesociallogin>
127
+ <file>icemax/aesociallogin.xml</file>
128
+ </aesociallogin>
129
+ </updates>
130
+ </layout>
131
+ <routers>
132
+ <aesociallogin>
133
+ <use>standard</use>
134
+ <args>
135
+ <module>Icemax_AESocialLogin</module>
136
+ <frontName>icemax-aesociallogin</frontName>
137
+ </args>
138
+ </aesociallogin>
139
+ </routers>
140
+ </frontend>
141
+
142
+ <default>
143
+ <aesociallogin>
144
+ <options>
145
+ <apikey></apikey>
146
+ <enable>0</enable>
147
+ <seamless>1</seamless>
148
+ <auth_window>1</auth_window>
149
+ <sso>application</sso>
150
+ <path_skin>{{base_skin}}/frontend/icemax</path_skin>
151
+ </options>
152
+ <!-- Set values of global config vars -->
153
+ <vars>
154
+ <connection_info></connection_info>
155
+ </vars>
156
+ </aesociallogin>
157
+ </default>
158
+ </config>
app/code/community/Icemax/AESocialLogin/etc/system.xml ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <icemax translate="label" module="aesociallogin">
5
+ <label>Icemax</label>
6
+ <sort_order>250</sort_order>
7
+ </icemax>
8
+ </tabs>
9
+ <sections>
10
+ <aesociallogin translate="label" module="aesociallogin">
11
+ <label>Appreciation Engine Social Login</label>
12
+ <tab>icemax</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <options translate="label">
20
+ <label>Options</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enable translate="label">
28
+ <label>Enable</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>10</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </enable>
36
+ <apikey translate="label">
37
+ <label>Appreciation Engine API key</label>
38
+ <frontend_type>text</frontend_type>
39
+ <comment><![CDATA[Please enter your Appreciation Engine API key.<br />API key as available in AE dashboard]]>
40
+ </comment>
41
+ <sort_order>20</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>0</show_in_store>
45
+ </apikey>
46
+ <framework_id translate="label">
47
+ <label>Appreciation Engine Framework ID</label>
48
+ <frontend_type>text</frontend_type>
49
+ <comment><![CDATA[FrameworkID as available in AE dashboard]]>
50
+ </comment>
51
+ <sort_order>30</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>0</show_in_store>
55
+ </framework_id>
56
+ <seamless>
57
+ <label>Seamless Registration</label>
58
+ <frontend_type>select</frontend_type>
59
+ <comment><![CDATA[Enabling this feature allows users authenticating via a provider that returns all necessary information to skip the registration form.]]>
60
+ </comment>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>40</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </seamless>
67
+ <endpoint>
68
+ <label>Appreciation Engine Endpoint</label>
69
+ <frontend_type>text</frontend_type>
70
+ <comment><![CDATA[Specifies The Appreciation Engine URL is used, for example, http://theappreciationengine.com/]]>
71
+ </comment>
72
+ <sort_order>50</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </endpoint>
77
+ <sso>
78
+ <label>SSO scope</label>
79
+ <frontend_type>select</frontend_type>
80
+ <comment><![CDATA[Scope determines whether a user will be automatically signed in (if sessions available)]]>
81
+ </comment>
82
+ <source_model>aesociallogin/system_config_sso</source_model>
83
+ <sort_order>60</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </sso>
88
+ <auth_window translate="label">
89
+ <label>Auth window type</label>
90
+ <frontend_type>select</frontend_type>
91
+ <source_model>aesociallogin/system_config_authwindow</source_model>
92
+ <sort_order>70</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </auth_window>
97
+ </fields>
98
+ </options>
99
+ <accountdata translate="label">
100
+ <label>Connection info</label>
101
+ <frontend_type>text</frontend_type>
102
+ <frontend_model>aesociallogin/accountdata</frontend_model>
103
+ <sort_order>50</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>1</show_in_store>
107
+ </accountdata>
108
+ <info translate="label">
109
+ <label>About</label>
110
+ <frontend_type>text</frontend_type>
111
+ <frontend_model>aesociallogin/info</frontend_model>
112
+ <sort_order>100</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </info>
117
+
118
+ <!-- Frame global uneditable config variables -->
119
+ <vars translate="label">
120
+ <label>Global Variables</label>
121
+ <frontend_type>text</frontend_type>
122
+ <sort_order>50</sort_order>
123
+ <show_in_default>0</show_in_default>
124
+ <show_in_website>0</show_in_website>
125
+ <show_in_store>0</show_in_store>
126
+ <fields>
127
+ <apikey translate="label">
128
+ <label>AESocialLogin API key</label>
129
+ <frontend_type>text</frontend_type>
130
+ <sort_order>10</sort_order>
131
+ <show_in_default>0</show_in_default>
132
+ <show_in_website>0</show_in_website>
133
+ <show_in_store>0</show_in_store>
134
+ </apikey>
135
+ </fields>
136
+ </vars>
137
+ </groups>
138
+ </aesociallogin>
139
+ </sections>
140
+ </config>
app/code/community/Icemax/AESocialLogin/sql/AESocialLogin_setup/mysql4-install-1.0.1.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magento.com so we can send you a copy immediately.
15
+ *
16
+ * @category Icemax
17
+ * @package Icemax_AESocialLogin
18
+ * @copyright Copyright (c) 2015 Icemax, Inc.
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ $installer = $this;
23
+
24
+ $installer->startSetup();
25
+ $installer->run("
26
+ CREATE TABLE `{$installer->getTable('appreciationengine_identifiers')}` (
27
+ `appreciationengine_identifier_id` int(11) NOT NULL AUTO_INCREMENT,
28
+ `identifier` varchar(255) NOT NULL,
29
+ `service_identifier` varchar(255) NOT NULL,
30
+ `customer_id` int(11) unsigned NOT NULL,
31
+ `profile_name` varchar(100) NOT NULL,
32
+ `provider` varchar(50) NOT NULL,
33
+ PRIMARY KEY (`appreciationengine_identifier_id`)
34
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
35
+ ");
36
+ $installer->endSetup();
app/design/frontend/base/default/layout/icemax/aesociallogin.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <!-- Initialize AE on every page. -->
4
+ <default>
5
+ <reference name="head">
6
+ <block type="core/template" name="icemax_aesociallogin_init" template="icemax/aesociallogin/init.phtml"/>
7
+ </reference>
8
+ </default>
9
+
10
+ <!-- Use our own register.phtml with no password fields and custom action -->
11
+ <aesociallogin_api_login>
12
+ <label>Customer Account Registration Form</label>
13
+ <!-- Mage_Customer -->
14
+ <remove name="right"/>
15
+ <remove name="left"/>
16
+ <reference name="root">
17
+ <action method="setTemplate">
18
+ <template>page/1column.phtml</template>
19
+ </action>
20
+ </reference>
21
+ <reference name="content">
22
+ <block type="customer/form_register" name="customer_form_register" template="icemax/aesociallogin/register.phtml">
23
+ <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
24
+ <label>Form Fields Before</label>
25
+ </block>
26
+ </block>
27
+ </reference>
28
+ </aesociallogin_api_login>
29
+
30
+ <!-- Ask users what they want to do when they enter an existing customer email address -->
31
+ <aesociallogin_api_duplicate>
32
+ <label>Customer Account Registration Form</label>
33
+ <!-- Mage_Customer -->
34
+ <remove name="right"/>
35
+ <remove name="left"/>
36
+ <reference name="root">
37
+ <action method="setTemplate">
38
+ <template>page/1column.phtml</template>
39
+ </action>
40
+ </reference>
41
+ <reference name="content">
42
+ <block type="customer/form_register" name="customer_form_register" template="icemax/aesociallogin/duplicate.phtml">
43
+ <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
44
+ <label>Form Fields Before</label>
45
+ </block>
46
+ </block>
47
+ </reference>
48
+ </aesociallogin_api_duplicate>
49
+ </layout>
app/design/frontend/base/default/template/icemax/aesociallogin/duplicate.phtml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Create account form template
4
+ * Modified by AESocialLogin
5
+ *
6
+ * @see Mage_Customer_Block_Form_Register
7
+ */
8
+ ?>
9
+ <div class="account-login">
10
+ <div class="page-title">
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('aesociallogin/api/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('aesociallogin/api/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('Icemax_AESocialLogin_' . Mage::helper('aesociallogin')->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/icemax/aesociallogin/init.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (Mage::getStoreConfig('aesociallogin/options/enable')): ?>
2
+ <script>
3
+ function AEJSReady(aeJS) {
4
+ // Specify the settings required for your environment (see Settings)
5
+ aeJS.settings['extra_fields_screen'] = 'after'; // 'disabled', 'before' or 'after'
6
+ aeJS.settings['auth_window'] = <?php echo Mage::getStoreConfig('aesociallogin/options/auth_window')?>;
7
+ aeJS.settings['return_url'] = "<?php echo Mage::getUrl('aesociallogin/api/login'); ?>";
8
+ aeJS.settings['sso'] = "<?php echo Mage::getStoreConfig('aesociallogin/options/sso'); ?>";
9
+
10
+ // Attach local handlers to events
11
+ aeJS.events.onLogin.addHandler(loginHandler);
12
+ }
13
+
14
+ //locally defined handlers
15
+ function loginHandler(user) {
16
+ <?php if (Mage::getStoreConfig('aesociallogin/options/auth_window') == 'true'): ?>
17
+ window.location.href = "<?php echo Mage::getUrl('aesociallogin/api/login'); ?>" + '?accessToken=' + user.data.AccessToken;
18
+ <?php endif; ?>
19
+ }
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="<?php echo Mage::getStoreConfig('aesociallogin/options/endpoint')?>/framework/js/<?php echo Mage::getStoreConfig('aesociallogin/options/framework_id') ?>"></script>
23
+ <?php endif; ?>
app/design/frontend/base/default/template/icemax/aesociallogin/register.phtml ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Create account form template
4
+ * Modified by AESocialLogin
5
+ *
6
+ * @see Mage_Customer_Block_Form_Register
7
+ */
8
+ ?>
9
+ <div class="account-create">
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('aesociallogin/api/createpost'); ?>" method="post" id="form-validate">
16
+ <div class="fieldset">
17
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
18
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
19
+ <ul class="form-list">
20
+ <li class="fields">
21
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
22
+ </li>
23
+ <li>
24
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
25
+ <div class="input-box">
26
+ <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" />
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
+ </div>
68
+ </div>
69
+ </li>
70
+ <li class="wide">
71
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
72
+ <div class="input-box">
73
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
74
+ </div>
75
+ </li>
76
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
77
+ <li class="wide">
78
+ <div class="input-box">
79
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text" />
80
+ </div>
81
+ </li>
82
+ <?php endfor ?>
83
+ <li class="fields">
84
+ <div class="field">
85
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
86
+ <div class="input-box">
87
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
88
+ </div>
89
+ </div>
90
+ <div class="field">
91
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
92
+ <div class="input-box">
93
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
94
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
95
+ </select>
96
+ <script type="text/javascript">
97
+ //<![CDATA[
98
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
99
+ //]]>
100
+ </script>
101
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
102
+ </div>
103
+ </div>
104
+ </li>
105
+ <li class="fields">
106
+ <div class="field">
107
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
108
+ <div class="input-box">
109
+ <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
110
+ </div>
111
+ </div>
112
+ <div class="field">
113
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
114
+ <div class="input-box">
115
+ <?php echo $this->getCountryHtmlSelect() ?>
116
+ </div>
117
+ </div>
118
+ </li>
119
+ </ul>
120
+ <input type="hidden" name="default_billing" value="1" />
121
+ <input type="hidden" name="default_shipping" value="1" />
122
+ </div>
123
+ <?php endif; ?>
124
+ <?php
125
+ $password = md5('Icemax_AESocialLogin_' . Mage::helper('aesociallogin')->rand_str(12));
126
+ ?>
127
+ <input type="hidden" name="password" value="<?php echo $password; ?>" />
128
+ <input type="hidden" name="confirmation" value="<?php echo $password; ?>" />
129
+ <input type="hidden" name="success_url" value="<?php echo Mage::getSingleton('customer/session')->getBeforeAuthUrl(); ?>" />
130
+
131
+ <div class="buttons-set">
132
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
133
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
134
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
135
+ </div>
136
+ </form>
137
+ <script type="text/javascript">
138
+ //<![CDATA[
139
+ var dataForm = new VarienForm('form-validate', true);
140
+ <?php if ($this->getShowAddressFields()): ?>
141
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
142
+ <?php endif; ?>
143
+ //]]>
144
+ </script>
145
+ </div>
app/etc/modules/Icemax_AESocialLogin.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Icemax_AESocialLogin>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ </Icemax_AESocialLogin>
7
+ </modules>
8
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Icemax_AESocialLogin</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/GPL-3.0">GNU General Public License (GPL) v 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>The Appreciation Engine Social Login</summary>
10
+ <description>Speed up your registration, login and checkout process with The Appreciation Engine Social Login</description>
11
+ <notes>Initial Release for The Appreciation Engine Social Login 1.0.1</notes>
12
+ <authors><author><name>Maxim Baybakov</name><user>icemax</user><email>maxim.baibakov@gmail.com</email></author></authors>
13
+ <date>2015-07-07</date>
14
+ <time>21:53:52</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Icemax_AESocialLogin.xml" hash="93d22118787c3a69710686ee59663413"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="icemax"><file name="aesociallogin.xml" hash="13daa8f1441a46eb2a7943e3ad04af7f"/></dir></dir><dir name="template"><dir name="icemax"><dir><dir name="aesociallogin"><file name="duplicate.phtml" hash="53610155524eaf0c58ec41a1d627990d"/><file name="init.phtml" hash="d37ca03aa7c9c78c67a5804bdfb348dc"/><file name="register.phtml" hash="3350e9cfc3bee975f940c23ed66cc8b2"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Icemax"><dir name="AESocialLogin"><dir name="Block"><file name="Accountdata.php" hash="ab6e5a04553c38ef5702ef1e5cac5e7b"/><file name="Info.php" hash="ea035bac79319cbfd01360506983969c"/></dir><dir name="Helper"><file name="Apicall.php" hash="0da413ed447bb7a7a691f23fb6bc1bc3"/><file name="Data.php" hash="3e33db60fec5c2269da49afdff9d7601"/><file name="Identifiers.php" hash="79896191c2322cf37c15a3474156cec4"/></dir><dir name="Model"><file name="Identifiers.php" hash="22646d595f3e0a4df314293c862c50c3"/><dir name="Mysql4"><dir name="Identifiers"><file name="Collection.php" hash="614a3f62e8c4ba17c3ce5b98921648ca"/></dir><file name="Identifiers.php" hash="db115c2617ded578dada55a66d50c7fa"/></dir><file name="Observer.php" hash="8c2571315c923aea7719480dc050fd9e"/><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="ab5e8ed13d7553bd85a950fb54c849f9"/></dir></dir></dir><file name="Session.php" hash="cd5812fc1ef49b2748fbc76c813a0080"/><dir name="System"><dir name="Config"><file name="Authwindow.php" hash="2ea4d0e893ccf7242263ddac35d3e5f2"/><file name="Sso.php" hash="3a5a350246ea869ac49c5e6e553a2247"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RefreshController.php" hash="b36ac4aabeb546c8edf31ac1f2b6ec56"/></dir><file name="ApiController.php" hash="6b745473df3e6bc659851f5d61362e58"/></dir><dir name="etc"><file name="config.xml" hash="0dbc1a452ec81df1fb9c3eb5eebe70e0"/><file name="system.xml" hash="4322d162dce73daa9bc12dd7313b8828"/></dir><dir name="sql"><dir name="AESocialLogin_setup"><file name="mysql4-install-1.0.1.php" hash="9158db6fee443285ce1d54b1b44be0ae"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>