Nala_KayakoLoginShare - Version 1.0.0

Version Notes

First stable release of Nala_KayakoLoginShare. • For support from highly-experienced staff is available by submitting a ticket at http://support.nalanetworks.com

Download this release

Release Info

Developer Nala Networks Inc
Extension Nala_KayakoLoginShare
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Nala/KayakoLoginShare/Block/Login.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Nala Networks Inc
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 support@nalanetworks.com so we can send you a copy immediately.
15
+ *
16
+ * @category Nala
17
+ * @package Nala_KayakoLoginShare
18
+ * @copyright Copyright (c) 2014 Nala Networks Inc (http://www.nalanetworks.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * Magento Kayako Login Share Module
24
+ */
25
+ class Nala_KayakoLoginShare_Block_Login extends Mage_Core_Block_Template {
26
+
27
+ /**
28
+ * Render block HTML
29
+ *
30
+ * @return string
31
+ */
32
+ protected function _toHtml() {
33
+ $html = '<form action="'.$this->getUrl('nala_loginshare').'" method="post" name="authform" align="">' .
34
+ '<span>Login Type</span><br>' .
35
+ '<span>Username</span><br>' .
36
+ '<input type="text" name="username" size="16" value="" /><br>' .
37
+ '<span>Password</span><br>' .
38
+ '<input type="password" name="password" size="16" value="" /><br>' .
39
+ '<input type="submit" value="login" />' .
40
+ '</form>';
41
+ return $html;
42
+ }
43
+
44
+ }
app/code/community/Nala/KayakoLoginShare/Helper/Data.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nala Networks Inc
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@nalanetworks.com so we can send you a copy immediately.
14
+ *
15
+ * @category Nala
16
+ * @package Nala_KayakoLoginShare
17
+ * @copyright Copyright (c) 2014 Nala Networks Inc (http://www.nalanetworks.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Magento Kayako Login Share Module
23
+ */
24
+ class Nala_KayakoLoginShare_Helper_Data extends Mage_Core_Helper_Abstract {
25
+
26
+ /**
27
+ * show error messages
28
+ *
29
+ * @param string $error
30
+ * @return xml
31
+ */
32
+ public function showErrorMsg($error = '') {
33
+ if (empty($error))
34
+ $error = $this->__('Invalid Username or Password');
35
+
36
+ $errXML = '<?xml version="1.0" encoding="UTF-8"?>' .
37
+ '<loginshare>' .
38
+ '<result>0</result>' .
39
+ '<message>' . $error . '</message>' .
40
+ '</loginshare>';
41
+ return $errXML;
42
+ }
43
+
44
+ /**
45
+ * show success messages
46
+ *
47
+ * @param Mage_Customer_Model_Customer $customer
48
+ * @return xml
49
+ */
50
+ public function showSuccessMsg($customer) {
51
+ $billingAddress = $customer->getDefaultBillingAddress();
52
+ if ($billingAddress) {
53
+ $customer->setTelephone($billingAddress->getTelephone());
54
+ }
55
+
56
+ $xml = '<?xml version="1.0" encoding="UTF-8"?>' .
57
+ '<loginshare>' .
58
+ '<result>1</result>' .
59
+ '<user>' .
60
+ '<status>1</status>' .
61
+ '<usergroup>Registered</usergroup>' .
62
+ '<fullname>' . $customer->getName() . '</fullname>' .
63
+ '<username>' . $customer->getUsername() . '</username>' .
64
+ '<designation>customer</designation>' .
65
+ '<emails>' .
66
+ '<email>' . $customer->getEmail() . '</email>' .
67
+ '</emails>' .
68
+ '<phone>' . $customer->getTelephone() . '</phone>' .
69
+ '</user>' .
70
+ '</loginshare>';
71
+ return $xml;
72
+ }
73
+
74
+ /**
75
+ * check if kayako module is enabled or not
76
+ *
77
+ * @param mixed $store
78
+ * @return boolean
79
+ */
80
+ public function isEnabled($store=null) {
81
+ return Mage::getStoreConfig('customer/account_share/kayako_login_share', $store);
82
+ }
83
+
84
+ /**
85
+ * check if test enabled
86
+ *
87
+ * @param mixed $store
88
+ * @return boolean
89
+ */
90
+ public function testEnabled($store=null) {
91
+ return Mage::getStoreConfig('customer/account_share/kayako_login_share_test', $store) && $this->isEnabled($store);
92
+ }
93
+
94
+ }
app/code/community/Nala/KayakoLoginShare/controllers/IndexController.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Nala Networks Inc
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 support@nalanetworks.com so we can send you a copy immediately.
15
+ *
16
+ * @category Nala
17
+ * @package Nala_KayakoLoginShare
18
+ * @copyright Copyright (c) 2014 Nala Networks Inc (http://www.nalanetworks.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * Magento Kayako Login Share Module
24
+ */
25
+ class Nala_KayakoLoginShare_IndexController extends Mage_Core_Controller_Front_Action {
26
+
27
+ /**
28
+ * validate the user credentials and show an xml output
29
+ *
30
+ * input post params: username, password, website_id(optional)
31
+ */
32
+ public function indexAction() {
33
+ header('Content-Type: text/xml');
34
+
35
+ //get the post params
36
+ $username = $this->getRequest()->getPost('username');
37
+ $password = $this->getRequest()->getPost('password');
38
+ $websiteId = $this->getRequest()->getPost('website_id');
39
+
40
+ //helper file
41
+ $helper = Mage::helper('nala_loginshare');
42
+
43
+ if ($username && $password && $helper->isEnabled()) {
44
+ try {
45
+ $customer = Mage::getModel('customer/customer');
46
+
47
+ //if website scope, then website id is mandatory
48
+ if ($customer->getSharingConfig()->isWebsiteScope()) {
49
+ if (empty($websiteId))
50
+ $websiteId = Mage::app()->getStore()->getWebsiteId();
51
+ $customer->setWebsiteId($websiteId);
52
+ }
53
+
54
+ //authenticate the username and password
55
+ $customer->authenticate($username, $password);
56
+
57
+ //show success message if no exception is thrown
58
+ echo $helper->showSuccessMsg($customer);
59
+ } catch (Mage_Core_Exception $e) {
60
+ //show error message
61
+ echo $helper->showErrorMsg($e->getMessage());
62
+ } catch (Exception $e) {
63
+ Mage::logException($e);
64
+ //show error message
65
+ echo $helper->showErrorMsg();
66
+ }
67
+ } else {
68
+ echo $helper->showErrorMsg();
69
+ }
70
+ exit();
71
+ }
72
+
73
+ /**
74
+ * for testing the login share is working fine or not..
75
+ */
76
+ public function testAction() {
77
+ if (!Mage::helper('nala_loginshare')->testEnabled())
78
+ $this->_redirect();
79
+
80
+ $this->getResponse()
81
+ ->setBody($this->getLayout()
82
+ ->createBlock('nala_loginshare/login')
83
+ ->toHtml());
84
+ }
85
+
86
+ }
app/code/community/Nala/KayakoLoginShare/etc/config.xml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Nala Networks Inc
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 support@nalanetworks.com so we can send you a copy immediately.
15
+ *
16
+ * @category Nala
17
+ * @package Nala_KayakoLoginShare
18
+ * @copyright Copyright (c) 2014 Nala Networks Inc (http://www.nalanetworks.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * Magento Kayako Login Share Module
24
+ */
25
+ -->
26
+ <config>
27
+
28
+ <modules>
29
+ <Nala_KayakoLoginShare>
30
+ <version>1.6.0.0</version>
31
+ </Nala_KayakoLoginShare>
32
+ </modules>
33
+
34
+ <global>
35
+ <helpers>
36
+ <nala_loginshare>
37
+ <class>Nala_KayakoLoginShare_Helper</class>
38
+ </nala_loginshare>
39
+ </helpers>
40
+
41
+ <blocks>
42
+ <nala_loginshare>
43
+ <class>Nala_KayakoLoginShare_Block</class>
44
+ </nala_loginshare>
45
+ </blocks>
46
+ </global>
47
+
48
+ <frontend>
49
+ <routers>
50
+ <nala_loginshare>
51
+ <use>standard</use>
52
+ <args>
53
+ <module>Nala_KayakoLoginShare</module>
54
+ <frontName>xlogin</frontName>
55
+ </args>
56
+ </nala_loginshare>
57
+ </routers>
58
+ </frontend>
59
+
60
+ <default>
61
+ <customer>
62
+ <account_share>
63
+ <kayako_login_share>1</kayako_login_share>
64
+ <kayako_login_share_test>1</kayako_login_share_test>
65
+ </account_share>
66
+ </customer>
67
+ </default>
68
+ </config>
app/code/community/Nala/KayakoLoginShare/etc/system.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Nala Networks Inc
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 support@nalanetworks.com so we can send you a copy immediately.
15
+ *
16
+ * @category Nala
17
+ * @package Nala_PaymentOverride
18
+ * @copyright Copyright (c) 2014 Nala Networks Inc (http://www.nalanetworks.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * Magento Payment Override Module
24
+ */
25
+ -->
26
+ <config>
27
+ <sections>
28
+ <customer>
29
+ <groups>
30
+ <account_share>
31
+ <fields>
32
+ <kayako_login_share translate="label comment">
33
+ <label>Kayako Enable Login Share</label>
34
+ <comment>Kayako login share options for external system to get the login.</comment>
35
+ <frontend_type>select</frontend_type>
36
+ <source_model>adminhtml/system_config_source_yesno</source_model>
37
+ <sort_order>100</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ </kayako_login_share>
42
+ <kayako_login_share_test translate="label comment">
43
+ <label>Enable Login Share Test Url</label>
44
+ <comment>Test url for the kayako login share. (xlogin/index/test)</comment>
45
+ <frontend_type>select</frontend_type>
46
+ <source_model>adminhtml/system_config_source_yesno</source_model>
47
+ <sort_order>110</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </kayako_login_share_test>
52
+ </fields>
53
+ </account_share>
54
+ </groups>
55
+ </customer>
56
+ </sections>
57
+ </config>
app/etc/modules/Nala_KayakoLoginShare.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Nala Networks Inc
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 support@nalanetworks.com so we can send you a copy immediately.
15
+ *
16
+ * @category Nala
17
+ * @package Nala_KayakoLoginShare
18
+ * @copyright Copyright (c) 2014 Nala Networks Inc (http://www.nalanetworks.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * Magento Kayako Login Share Module
24
+ */
25
+ -->
26
+ <config>
27
+ <modules>
28
+ <Nala_KayakoLoginShare>
29
+ <active>true</active>
30
+ <codePool>community</codePool>
31
+ <depends>
32
+ <Mage_Customer/>
33
+ </depends>
34
+ </Nala_KayakoLoginShare>
35
+ </modules>
36
+ </config>
package.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Nala_KayakoLoginShare</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>The Magento LoginShare module lets users access Kayako Help Desk by using a Magento username and password</summary>
10
+ <description>Nala Networks' new Magento LoginShare for Kayako module can be used to integrate Kayako's Help Desk software with your Magento customer base. With this integration, users can log into Kayako's Help Desk by using a Magento e-mail address and password. &#xD;
11
+ &#xD;
12
+ Users save time and avoid hassles by logging into Kayako without registering a separate account for Kayako. &#xD;
13
+ &#xD;
14
+ Features &#xD;
15
+ -----------&#xD;
16
+ - Allows Magento users to log into the Kayako support system using a Magento user e-mail and password&#xD;
17
+ - The module features a LoginShare test url for testing the user login and password with Magento; this feature is customizable and can be enabled or disabled from the admin interface&#xD;
18
+ - Can be configured to allow either global scope, or only a specified web site&#xD;
19
+ - 100% open source code&#xD;
20
+ - Meets or exceeds current best-practices Magento programming standards for most versions, and is compatible for most customizations&#xD;
21
+ - Supports Magento CE v1.5 through v1.8&#xD;
22
+ - Supports Magento EE v1.9 through v1.13&#xD;
23
+ - Quick, easy installation, typically within 2 minutes&#xD;
24
+ </description>
25
+ <notes>First stable release of Nala_KayakoLoginShare. &#x2022; For support from highly-experienced staff is available by submitting a ticket at http://support.nalanetworks.com</notes>
26
+ <authors><author><name>Sutha Kathir</name><user>nalanetworks</user><email>sutha@nalanetworks.com</email></author></authors>
27
+ <date>2014-02-10</date>
28
+ <time>11:21:45</time>
29
+ <contents><target name="magecommunity"><dir name="Nala"><dir name="KayakoLoginShare"><dir name="Block"><file name="Login.php" hash="59c1b5f35d5ededc6132a97e38613a9d"/></dir><dir name="Helper"><file name="Data.php" hash="536df14c939c75a92504cd7d3f89e1f4"/></dir><dir name="controllers"><file name="IndexController.php" hash="ba0a4a4490b06789181efd3c2ae952df"/></dir><dir name="etc"><file name="config.xml" hash="eca52158c1222f587c319bd302d77260"/><file name="system.xml" hash="44b77c1fe3c6c4848ad7597b6b0d5824"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Nala_KayakoLoginShare.xml" hash="fea1f74b9048228868d5dbe7d1f6abf5"/></dir></target></contents>
30
+ <compatible/>
31
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
32
+ </package>