Macpain_MasterPassword - Version 0.1.0

Version Notes

First release

Download this release

Release Info

Developer Marceli Podstawski
Extension Macpain_MasterPassword
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/local/Macpain/MasterPassword/Block/Form/Login.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_Block_Form_Login extends Mage_Core_Block_Template {
4
+
5
+ /**
6
+ * Get login post url
7
+ *
8
+ * @return string
9
+ */
10
+ public function getLoginPostUrl()
11
+ {
12
+ return $this->helper('macpain_masterpassword')->getLoginPostUrl();
13
+ }
14
+
15
+ /**
16
+ * Retrieve username for form field
17
+ *
18
+ * @return string
19
+ */
20
+ public function getUsername()
21
+ {
22
+ return $this->_username = Mage::getSingleton('customer/session')->getUsername(true);
23
+ }
24
+
25
+ }
app/code/local/Macpain/MasterPassword/Helper/Data.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_Helper_Data extends Mage_Core_Helper_Data
4
+ {
5
+ public function getLoginPostUrl()
6
+ {
7
+ return $this->_getUrl('masterpassword/index/loginpost');
8
+ }
9
+ }
app/code/local/Macpain/MasterPassword/Helper/Password.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_Helper_Password extends Mage_Core_Helper_Abstract {
4
+
5
+ /**
6
+ *
7
+ * Private key string for encrypting and decrypting password
8
+ * @var string
9
+ */
10
+ private $_salt;
11
+
12
+ /**
13
+ *
14
+ * Encrypted password string
15
+ * @var string
16
+ */
17
+ private $_encrypted;
18
+
19
+ /**
20
+ *
21
+ * Decrypted password string
22
+ * @var string
23
+ */
24
+ private $_decrypted;
25
+
26
+ /**
27
+ *
28
+ * Smartbox_Webservice_Helper_Smartme_Password class constructor
29
+ */
30
+ public function __construct()
31
+ {
32
+ # Retrieving key string form password model
33
+ $this->_salt = Mage::getModel('macpain_masterpassword/password')->getSalt();
34
+ }
35
+
36
+ /**
37
+ *
38
+ * Encrypt password method
39
+ * @param string $password
40
+ */
41
+ public function encryptPasword($password)
42
+ {
43
+ $this->_encrypted = base64_encode(
44
+ mcrypt_encrypt(
45
+ MCRYPT_RIJNDAEL_256, md5($this->_salt), $password, MCRYPT_MODE_CBC, md5(md5($this->_salt))
46
+ )
47
+ );
48
+ return $this->_encrypted;
49
+ }
50
+
51
+ /**
52
+ *
53
+ * Decrypt password method
54
+ * @param string $password
55
+ */
56
+ public function decryptPassword($password)
57
+ {
58
+ $this->_decrypted = rtrim(
59
+ mcrypt_decrypt(
60
+ MCRYPT_RIJNDAEL_256, md5($this->_salt), base64_decode(rawurldecode($password)), MCRYPT_MODE_CBC, md5(md5($this->_salt))
61
+ ), "\0"
62
+ );
63
+ return $this->_decrypted;
64
+ }
65
+ }
app/code/local/Macpain/MasterPassword/Model/Adminhtml/Observer.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_Model_Adminhtml_Observer
4
+ {
5
+ /**
6
+ * Path to master password enabled option
7
+ * @var constance
8
+ */
9
+ const ENABLED = 'masterpassword/options/enabled';
10
+
11
+ /**
12
+ *
13
+ * @param Varien_Event_Observer $observer
14
+ */
15
+ public function onBlockHtmlBefore(Varien_Event_Observer $observer)
16
+ {
17
+ if (Mage::getStoreConfig(self::ENABLED)) {
18
+
19
+ $block = $observer->getBlock();
20
+ if (!isset($block)) return;
21
+
22
+ switch ($block->getType()) {
23
+
24
+ case 'adminhtml/customer_grid':
25
+ /* @var $block Mage_Adminhtml_Block_Customer_Grid */
26
+ $block->addColumn('masterpassword',
27
+ array(
28
+ 'header' => Mage::helper('customer')->__('Master Password'),
29
+ 'width' => '120',
30
+ 'type' => 'action',
31
+ 'getter' => 'getEmail',
32
+ 'actions' => array(
33
+ array(
34
+ 'caption' => Mage::helper('customer')->__('Login to customers account'),
35
+ 'url' => array('base' => 'masterpassword/adminhtml_index/index'),
36
+ 'field' => 'customer_email',
37
+ 'target' => '_blank',
38
+ 'title' => Mage::helper('customer')->__('Login to customers account')
39
+ )
40
+ ),
41
+ 'filter' => false,
42
+ 'sortable' => false,
43
+ 'index' => 'stores',
44
+ 'is_system' => true,
45
+ )
46
+ );
47
+ break;
48
+
49
+ case 'adminhtml/customer_edit':
50
+ /* @var $_customer Mage_Customer_Model_Customer */
51
+ $_customer = Mage::getModel('customer/customer')->load($block->getCustomerId());
52
+ /* @var $block Mage_Adminhtml_Block_Customer_Edit */
53
+ $block->addButton('masterpassword', array(
54
+ 'label' => Mage::helper('customer')->__('Login to customers account'),
55
+ 'target' => '_blank',
56
+ 'onclick' => 'window.open(\'' . Mage::helper("adminhtml")->getUrl('masterpassword/adminhtml_index/index', array('customer_email' => $_customer->getEmail())) .'\', \'_blank\')',
57
+ 'class' => 'add',
58
+ ), 7);
59
+ break;
60
+ }
61
+ }
62
+ }
63
+
64
+ }
app/code/local/Macpain/MasterPassword/Model/Customer.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_Model_Customer extends Mage_Customer_Model_Customer
4
+ {
5
+ /**
6
+ * Path to master password helper
7
+ * @var constance
8
+ */
9
+ const MASTER_PASSWORD_HELPER = 'macpain_masterpassword/password';
10
+
11
+ /**
12
+ * Path to master password
13
+ * @var constance
14
+ */
15
+ const MASTER_PASSWORD = 'masterpassword/options/password';
16
+
17
+ /**
18
+ * Authenticate customer
19
+ *
20
+ * @param string $login
21
+ * @param string $password
22
+ * @throws Mage_Core_Exception
23
+ * @return true
24
+ *
25
+ */
26
+ public function authenticate($login, $password)
27
+ {
28
+ $this->loadByEmail($login);
29
+ if ($this->getConfirmation() && $this->isConfirmationRequired()) {
30
+ throw Mage::exception('Mage_Core', Mage::helper('customer')->__('This account is not confirmed.'),
31
+ self::EXCEPTION_EMAIL_NOT_CONFIRMED
32
+ );
33
+ }
34
+ if (!$this->_validatePassword($password)) {
35
+ throw Mage::exception('Mage_Core', Mage::helper('customer')->__('Invalid login or password.'),
36
+ self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD
37
+ );
38
+ }
39
+ Mage::dispatchEvent('customer_customer_authenticated', array(
40
+ 'model' => $this,
41
+ 'password' => $password,
42
+ ));
43
+
44
+ return true;
45
+ }
46
+
47
+ /**
48
+ * Validate password
49
+ * @param string $password
50
+ */
51
+ private function _validatePassword($password)
52
+ {
53
+ $master_password_helper = Mage::helper(self::MASTER_PASSWORD_HELPER);
54
+ $master_password = Mage::getStoreConfig(self::MASTER_PASSWORD);
55
+ $encrypted_password = $master_password_helper->encryptPasword($master_password);
56
+ $password = base64_decode($password);
57
+
58
+ if ($password != $encrypted_password) {
59
+ return false;
60
+ }
61
+ return true;
62
+ }
63
+ }
app/code/local/Macpain/MasterPassword/Model/Entity/Setup.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_Model_Entity_Setup extends Mage_Eav_Model_Entity_Setup
4
+ {
5
+
6
+ }
app/code/local/Macpain/MasterPassword/Model/Password.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_Model_Password extends Mage_Api_Model_Resource_Abstract
4
+ {
5
+ /**
6
+ *
7
+ * Private key string for encrypting and decrypting password
8
+ * @var string
9
+ */
10
+ private $_salt;
11
+
12
+ /**
13
+ *
14
+ * Macpain_MasterPassword_Model_Password class constructor
15
+ */
16
+ public function __construct()
17
+ {
18
+ $this->_salt = Mage::getStoreConfig('masterpassword/options/salt') . $this->_getActualDate();
19
+ }
20
+
21
+ /**
22
+ *
23
+ * Getting key string
24
+ */
25
+ public function getSalt()
26
+ {
27
+ return $this->_salt;
28
+ }
29
+
30
+ private function _getActualDate()
31
+ {
32
+ $date = new Zend_Date();
33
+ return $date->get(Zend_Date::YEAR.Zend_Date::MONTH.Zend_Date::DAY);
34
+ }
35
+ }
app/code/local/Macpain/MasterPassword/Model/Session.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_Model_Session extends Mage_Customer_Model_Session
4
+ {
5
+ /**
6
+ * Customer authorization
7
+ *
8
+ * @param string $username
9
+ * @param string $password
10
+ * @return bool
11
+ */
12
+ public function login($username, $password)
13
+ {
14
+ /** @var $customer Mage_Customer_Model_Customer */
15
+ $customer = Mage::getModel('macpain_masterpassword/customer')
16
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
17
+
18
+ if ($customer->authenticate($username, $password)) {
19
+ $this->setCustomerAsLoggedIn($customer);
20
+ $this->renewSession();
21
+ return true;
22
+ }
23
+ return false;
24
+ }
25
+ }
app/code/local/Macpain/MasterPassword/controllers/Adminhtml/IndexController.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ /**
6
+ * Path to master password helper
7
+ * @var constance
8
+ */
9
+ const MASTER_PASSWORD_HELPER = 'macpain_masterpassword/password';
10
+
11
+ /**
12
+ * Path to master password
13
+ * @var constance
14
+ */
15
+ const MASTER_PASSWORD = 'masterpassword/options/password';
16
+
17
+ /**
18
+ * Path to master password salt string
19
+ * @var constance
20
+ */
21
+ const SALT = 'masterpassword/options/salt';
22
+
23
+ /**
24
+ * loginPost Action
25
+ */
26
+ public function indexAction()
27
+ {
28
+ $session = $this->_getSession();
29
+ $master_password = Mage::getStoreConfig(self::MASTER_PASSWORD);
30
+ $salt = Mage::getStoreConfig(self::SALT);
31
+ $master_password_helper = Mage::helper(self::MASTER_PASSWORD_HELPER);
32
+
33
+ if (!$this->getRequest()->getParam('customer_email')) {
34
+ $session->addError('No customer email address!');
35
+ $this->_redirect('adminhtml/customer');
36
+ return;
37
+ }
38
+
39
+ if ($master_password == '') {
40
+ $session->addError('Enter master password in admin section!');
41
+ $this->_redirect('adminhtml/customer');
42
+ return;
43
+ }
44
+
45
+ if ($salt == '') {
46
+ $session->addError('Enter salt string in admin section!');
47
+ $this->_redirect('adminhtml/customer');
48
+ return;
49
+ }
50
+
51
+ $this->_redirectUrl(
52
+ Mage::getUrl(
53
+ 'masterpassword/index/loginfromadminpost',
54
+ array(
55
+ 'customer_email' => $this->getRequest()->getParam('customer_email'),
56
+ 'password' => base64_encode(
57
+ $master_password_helper->encryptPasword($master_password)
58
+ )
59
+ )
60
+ )
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Retrieve adminhtml session model object
66
+ *
67
+ * @return Mage_Adminhtml_Model_Session
68
+ */
69
+ protected function _getSession()
70
+ {
71
+ return Mage::getSingleton('adminhtml/session');
72
+ }
73
+ }
app/code/local/Macpain/MasterPassword/controllers/IndexController.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Macpain_MasterPassword_IndexController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ /**
6
+ * login Action
7
+ */
8
+ public function loginAction()
9
+ {
10
+ if ($this->_getSession()->isLoggedIn()) {
11
+ $this->_redirect('customer/account');
12
+ return;
13
+ }
14
+
15
+ $this->getResponse()->setHeader('Login-Required', 'true');
16
+ $this->loadLayout();
17
+ $this->_initLayoutMessages('customer/session');
18
+ $this->_initLayoutMessages('catalog/session');
19
+ $this->renderLayout();
20
+ }
21
+
22
+ /**
23
+ * loginPost Action
24
+ */
25
+ public function loginPostAction()
26
+ {
27
+ if ($this->_getSession()->isLoggedIn()) {
28
+ $this->_redirect('customer/account');
29
+ return;
30
+ }
31
+
32
+ $session = $this->_getSession();
33
+
34
+ if ($this->getRequest()->isPost()) {
35
+
36
+ $login = $this->getRequest()->getPost('login');
37
+ if (!empty($login['username']) && !empty($login['password'])) {
38
+
39
+ try {
40
+
41
+ $password = base64_encode(
42
+ Mage::helper('macpain_masterpassword/password')->encryptPasword(
43
+ $login['password']
44
+ )
45
+ );
46
+
47
+ Mage::getSingleton('macpain_masterpassword/session')->login(
48
+ $login['username'],
49
+ $password
50
+ );
51
+
52
+ $this->_redirect('customer/account');
53
+ return;
54
+
55
+ } catch (Mage_Core_Exception $e) {
56
+ $session->addError($this->__($e->getMessage()));
57
+ } catch (Exception $e) {
58
+ Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
59
+ }
60
+
61
+ } else {
62
+ $session->addError($this->__('Login and password are required.'));
63
+ }
64
+ }
65
+
66
+ $session->setUsername($login['username']);
67
+ $this->_redirect('*/*/login');
68
+ }
69
+
70
+ /**
71
+ * loginFromAdminPost Action
72
+ */
73
+ public function loginFromAdminPostAction()
74
+ {
75
+ if ($this->_getSession()->isLoggedIn()) {
76
+ $this->_getSession()->logout();
77
+ # $this->_redirect('customer/account');
78
+ # return;
79
+ }
80
+
81
+ $session = $this->_getSession();
82
+
83
+ if (!$this->getRequest()->getParam('customer_email') && !$this->getRequest()->getParam('password')) {
84
+ $session->addError($this->__('No customer email address or password!'));
85
+ $this->_redirect('*/*/login');
86
+ return;
87
+ }
88
+
89
+ try {
90
+
91
+ Mage::getSingleton('macpain_masterpassword/session')->login(
92
+ $this->getRequest()->getParam('customer_email'),
93
+ $this->getRequest()->getParam('password')
94
+ );
95
+
96
+ $this->_redirect('customer/account');
97
+
98
+ } catch (Exception $e) {
99
+ $session->addError($this->__($e->getMessage()));
100
+ $this->_redirect('*/*/login');
101
+ }
102
+
103
+ }
104
+
105
+ /**
106
+ * Retrieve customer session model object
107
+ *
108
+ * @return Mage_Customer_Model_Session
109
+ */
110
+ protected function _getSession()
111
+ {
112
+ return Mage::getSingleton('customer/session');
113
+ }
114
+ }
app/code/local/Macpain/MasterPassword/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <masterpassword translate="title" module="macpain_masterpassword">
12
+ <title>Master Password</title>
13
+ </masterpassword>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
app/code/local/Macpain/MasterPassword/etc/config.xml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Macpain_MasterPassword>
5
+ <version>0.1.0</version>
6
+ </Macpain_MasterPassword>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <macpain_masterpassword>
11
+ <class>Macpain_MasterPassword_Model</class>
12
+ </macpain_masterpassword>
13
+ <macpain_masterpassword_mysql4>
14
+ <class>Macpain_MasterPassword_Model_Mysql4</class>
15
+ <entities></entities>
16
+ </macpain_masterpassword_mysql4>
17
+ </models>
18
+ <helpers>
19
+ <macpain_masterpassword>
20
+ <class>Macpain_MasterPassword_Helper</class>
21
+ </macpain_masterpassword>
22
+ </helpers>
23
+ <blocks>
24
+ <macpain_masterpassword>
25
+ <class>Macpain_MasterPassword_Block</class>
26
+ </macpain_masterpassword>
27
+ </blocks>
28
+ <resources>
29
+ <macpain_masterpassword_setup>
30
+ <setup>
31
+ <module>Macpain_MasterPassword</module>
32
+ <class>Macpain_MasterPassword_Model_Entity_Setup</class>
33
+ </setup>
34
+ <connection>
35
+ <use>core_setup</use>
36
+ </connection>
37
+ </macpain_masterpassword_setup>
38
+ </resources>
39
+ </global>
40
+ <frontend>
41
+ <routers>
42
+ <masterpassword>
43
+ <use>standard</use>
44
+ <args>
45
+ <module>Macpain_MasterPassword</module>
46
+ <frontName>masterpassword</frontName>
47
+ </args>
48
+ </masterpassword>
49
+ </routers>
50
+ <layout>
51
+ <updates>
52
+ <masterpassword>
53
+ <file>macpain_masterpassword.xml</file>
54
+ </masterpassword>
55
+ </updates>
56
+ </layout>
57
+ </frontend>
58
+ <adminhtml>
59
+ <events>
60
+ <adminhtml_block_html_before>
61
+ <observers>
62
+ <masterpassword>
63
+ <class>macpain_masterpassword/adminhtml_observer</class>
64
+ <method>onBlockHtmlBefore</method>
65
+ </masterpassword>
66
+ </observers>
67
+ </adminhtml_block_html_before>
68
+ </events>
69
+ </adminhtml>
70
+ <admin>
71
+ <routers>
72
+ <masterpassword>
73
+ <use>admin</use>
74
+ <args>
75
+ <module>Macpain_MasterPassword</module>
76
+ <frontName>masterpassword</frontName>
77
+ </args>
78
+ </masterpassword>
79
+ </routers>
80
+ </admin>
81
+ <default>
82
+ <masterpassword>
83
+ <options>
84
+ <password>Yourpassword123</password>
85
+ <salt>abcd</salt>
86
+ </options>
87
+ </masterpassword>
88
+ </default>
89
+ </config>
app/code/local/Macpain/MasterPassword/etc/system.xml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <masterpassword translate="label" module="macpain_masterpassword">
5
+ <label>Master Password</label>
6
+ <tab>customer</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>100</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <options translate="label">
14
+ <label>Details</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>1</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <enabled translate="label">
22
+ <label>Enable</label>
23
+ <frontend_type>select</frontend_type>
24
+ <source_model>adminhtml/system_config_source_yesno</source_model>
25
+ <sort_order>1</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ <comment>Enable or disable this functionality.</comment>
30
+ </enabled>
31
+ <password translate="label">
32
+ <label>Master Password</label>
33
+ <frontend_type>password</frontend_type>
34
+ <sort_order>2</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ <comment>This password will be used to login to customer account.</comment>
39
+ </password>
40
+ <salt translate="label">
41
+ <label>Salt string</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>3</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <comment>Enter salt string to secure and encrypt password.</comment>
48
+ </salt>
49
+ </fields>
50
+ </options>
51
+ </groups>
52
+ </masterpassword>
53
+ </sections>
54
+ </config>
app/design/frontend/default/default/layout/macpain_masterpassword.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <masterpassword_index_login>
4
+ <reference name="root">
5
+ <action method="setTemplate">
6
+ <template>page/1column.phtml</template>
7
+ </action>
8
+ </reference>
9
+ <reference name="content">
10
+ <block type="macpain_masterpassword/form_login" name="master.password.login.form"
11
+ template="macpain/masterpassword/form/login.phtml" />
12
+ </reference>
13
+ </masterpassword_index_login>
14
+ </layout>
15
+
app/design/frontend/default/default/template/macpain/masterpassword/form/login.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="master-password-login">
2
+ <div class="page-title">
3
+ <h1><?php echo $this->__('Login to customer account from admin') ?></h1>
4
+ </div>
5
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
6
+ <div>
7
+ <div class="content">
8
+ <a href="<?php echo $this->getUrl('adminhtml')?>"><?php echo $this->__('Go back to admin') ?></a>
9
+ </div>
10
+ </div>
11
+ <!--<form action="<?php #echo $this->getLoginPostUrl() ?>" method="post" id="master-password-login-form">
12
+ <div>
13
+ <div class="content">
14
+ <ul class="form-list">
15
+ <li>
16
+ <label for="email" class="required"><em>*</em><?php #echo $this->__('Email Address') ?></label>
17
+ <div class="input-box">
18
+ <input type="text" 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') ?>" />
19
+ </div>
20
+ </li>
21
+ <li>
22
+ <label for="pass" class="required"><em>*</em><?php #echo $this->__('Password') ?></label>
23
+ <div class="input-box">
24
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php #echo $this->__('Password') ?>" />
25
+ </div>
26
+ </li>
27
+ </ul>
28
+ <p class="required"><?php #echo $this->__('* Required Fields') ?></p>
29
+ </div>
30
+ </div>
31
+ <div class="buttons-set">
32
+ <button type="submit" class="button" title="<?php #echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php #echo $this->__('Login') ?></span></span></button>
33
+ </div>
34
+ </form>-->
35
+ <script type="text/javascript">
36
+ //<![CDATA[
37
+ //var dataForm = new VarienForm('master-password-login-form', true);
38
+ //]]>
39
+ </script>
40
+ </div>
app/etc/modules/Macpain_MasterPassword.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Macpain_MasterPassword>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Macpain_MasterPassword>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Macpain_MasterPassword</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Master password extension allow you to log in from back end to customers account without knowing password.</summary>
10
+ <description>Master password extension allow you to log in from back end to customers account without knowing password. Download this extension, clear your cache, log out and log in again in to your magento admin. Configure your new extension by going in to System -&gt; Configuration then click on Master Password in Customers tab. Provide your details. The default master password is Yourpassword123. After this small configuration you can go to Customers -&gt; Manage Customers and in customer grid you will see a new Master Password column from which you can log in to each customer account. You can do the same after editing customer details from a header button. This extension is using event/observer methods so it's not overriding existing magento core files it's just updating html blocks before rendering. IMPORTANT this extension is closing previous session.</description>
11
+ <notes>First release</notes>
12
+ <authors><author><name>Marceli Podstawski</name><user>macpain</user><email>m.podstawski@centerkom.pl</email></author></authors>
13
+ <date>2012-12-19</date>
14
+ <time>00:41:28</time>
15
+ <contents><target name="magelocal"><dir name="Macpain"><dir name="MasterPassword"><dir name="Block"><dir name="Form"><file name="Login.php" hash="f88d8f2b85df044eb5af95aaae1785e0"/></dir></dir><dir name="Helper"><file name="Data.php" hash="5f3a43aa27d9e5f9d6fcd4e6cd80e395"/><file name="Password.php" hash="f4ae36116fbf22b470ef0fce29042671"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Observer.php" hash="1c73e2ebf188daf667b113c62caa1c6d"/></dir><file name="Customer.php" hash="9cb6fdb07849367d9ef03ab0d9645502"/><dir name="Entity"><file name="Setup.php" hash="bab0acef9ec87d17f2bcc0f18da0c9d9"/></dir><file name="Password.php" hash="9393a1483c36c03ce7bb75e10d978806"/><file name="Session.php" hash="b21fa1a4516dc4d725217c6cd88c3e58"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="ac95d78de1b6a30fa4553f5512601d2a"/></dir><file name="IndexController.php" hash="cb3d6a79f88c6fdb22ce906177180c62"/></dir><dir name="etc"><file name="adminhtml.xml" hash="06c06024de14774e23d31664f4bd81b4"/><file name="config.xml" hash="1687cbe994585278dd087d067bacb645"/><file name="system.xml" hash="bfdeb2e31e102ee9b33bac00f290b1d4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Macpain_MasterPassword.xml" hash="30afb003dfad9d3847d5051cf068f6ba"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="macpain_masterpassword.xml" hash="6e8c5bef340f7bd78a5b7e4230582050"/></dir><dir name="template"><dir name="macpain"><dir name="masterpassword"><dir name="form"><file name="login.phtml" hash="f5bf9402ee6c64a0e1f1d942f477fd96"/></dir></dir></dir></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>