Version Notes
First release
Download this release
Release Info
Developer | Karuppusamy Ganesan |
Extension | Filact_Accountshield |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Filact/Accountshield/Block/Adminhtml/Lockout.php +45 -0
- app/code/community/Filact/Accountshield/Block/Adminhtml/Lockout/Grid.php +158 -0
- app/code/community/Filact/Accountshield/Block/Adminhtml/Lockout/Grid/Renderer/Islocked.php +43 -0
- app/code/community/Filact/Accountshield/Helper/Admin.php +37 -0
- app/code/community/Filact/Accountshield/Helper/Data.php +24 -0
- app/code/community/Filact/Accountshield/Model/Lockout.php +171 -0
- app/code/community/Filact/Accountshield/Model/Observer.php +211 -0
- app/code/community/Filact/Accountshield/Model/Resource/Lockout.php +32 -0
- app/code/community/Filact/Accountshield/Model/Resource/Lockout/Collection.php +30 -0
- app/code/community/Filact/Accountshield/Model/Resource/Setup.php +24 -0
- app/code/community/Filact/Accountshield/controllers/Adminhtml/LockoutController.php +183 -0
- app/code/community/Filact/Accountshield/etc/adminhtml.xml +77 -0
- app/code/community/Filact/Accountshield/etc/config.xml +143 -0
- app/code/community/Filact/Accountshield/etc/system.xml +76 -0
- app/code/community/Filact/Accountshield/sql/accountshield_setup/install-1.0.0.php +88 -0
- app/design/adminhtml/default/default/layout/Filact_Accountshield.xml +19 -0
- app/etc/modules/Filact_Accountshield.xml +32 -0
- app/locale/en_US/Filact_Accountshield.csv +40 -0
- package.xml +18 -0
app/code/community/Filact/Accountshield/Block/Adminhtml/Lockout.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Adminhtml manage lockout grid container
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Block_Adminhtml_Lockout extends Mage_Adminhtml_Block_Widget_Grid_Container
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Block constructor - Adminhtml Manage Lockout
|
26 |
+
*/
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
$this->_blockGroup = 'accountshield';
|
30 |
+
$this->_controller = 'adminhtml_lockout';
|
31 |
+
$this->_headerText = Mage::helper('accountshield')->__('Manage Account Lockout');
|
32 |
+
|
33 |
+
parent::__construct();
|
34 |
+
$this->_addButton('delete_all', array(
|
35 |
+
'label' => Mage::helper('adminhtml')->__('Delete All'),
|
36 |
+
'onclick' => "
|
37 |
+
if (confirm('". Mage::helper('accountshield')->__('Are you sure to delete all locks?') ."')) {
|
38 |
+
setLocation('". $this->getUrl('*/*/deleteAll') ."')
|
39 |
+
}",
|
40 |
+
'class' => 'task',
|
41 |
+
'confirm' => Mage::helper('accountshield')->__('Are you sure?')
|
42 |
+
), -100);
|
43 |
+
$this->_removeButton('add');
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Filact/Accountshield/Block/Adminhtml/Lockout/Grid.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Adminhtml manage lockout grid
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Block_Adminhtml_Lockout_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Init Grid default properties
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
parent::__construct();
|
31 |
+
$this->setId('account_lockout_list');
|
32 |
+
$this->setDefaultSort('created_at');
|
33 |
+
$this->setDefaultDir('DESC');
|
34 |
+
$this->setSaveParametersInSession(true);
|
35 |
+
$this->setUseAjax(true);
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Prepare collection for Grid
|
40 |
+
*
|
41 |
+
* @return Filact_Accountshield_Block_Adminhtml_Grid
|
42 |
+
*/
|
43 |
+
protected function _prepareCollection()
|
44 |
+
{
|
45 |
+
$collection = Mage::getModel('accountshield/lockout')->getResourceCollection();
|
46 |
+
|
47 |
+
$this->setCollection($collection);
|
48 |
+
return parent::_prepareCollection();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Prepare Grid columns
|
53 |
+
*
|
54 |
+
* @return Mage_Adminhtml_Block_Catalog_Search_Grid
|
55 |
+
*/
|
56 |
+
protected function _prepareColumns()
|
57 |
+
{
|
58 |
+
$this->addColumn('id', array(
|
59 |
+
'header' => Mage::helper('accountshield')->__('ID'),
|
60 |
+
'width' => '50px',
|
61 |
+
'index' => 'id',
|
62 |
+
));
|
63 |
+
|
64 |
+
$this->addColumn('username', array(
|
65 |
+
'header' => Mage::helper('accountshield')->__('Username'),
|
66 |
+
'index' => 'username',
|
67 |
+
));
|
68 |
+
|
69 |
+
$this->addColumn('lognum', array(
|
70 |
+
'header' => Mage::helper('accountshield')->__('Total Login Times'),
|
71 |
+
'width' => '50px',
|
72 |
+
'index' => 'lognum',
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addColumn('failures_num', array(
|
76 |
+
'header' => Mage::helper('accountshield')->__('Total Failure Times'),
|
77 |
+
'width' => '50px',
|
78 |
+
'index' => 'failures_num',
|
79 |
+
));
|
80 |
+
|
81 |
+
$this->addColumn('cur_failure_num', array(
|
82 |
+
'header' => Mage::helper('accountshield')->__('Current Failure Attempts'),
|
83 |
+
'width' => '50px',
|
84 |
+
'index' => 'cur_failure_num',
|
85 |
+
));
|
86 |
+
|
87 |
+
$this->addColumn('last_failure_at', array(
|
88 |
+
'header' => Mage::helper('accountshield')->__('Last Failure At'),
|
89 |
+
'sortable' => true,
|
90 |
+
'width' => '170px',
|
91 |
+
'index' => 'last_failure_at',
|
92 |
+
'type' => 'datetime',
|
93 |
+
));
|
94 |
+
|
95 |
+
$this->addColumn('website_id', array(
|
96 |
+
'header' => Mage::helper('accountshield')->__('Website'),
|
97 |
+
'align' => 'center',
|
98 |
+
'width' => '100px',
|
99 |
+
'type' => 'options',
|
100 |
+
'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true),
|
101 |
+
'index' => 'website_id',
|
102 |
+
));
|
103 |
+
|
104 |
+
$this->addColumn('is_locked', array(
|
105 |
+
'header' => Mage::helper('accountshield')->__('Is Locked?'),
|
106 |
+
'sortable' => true,
|
107 |
+
'width' => '170px',
|
108 |
+
'index' => 'is_locked',
|
109 |
+
'filter' => false,
|
110 |
+
'sortable' => false,
|
111 |
+
'renderer' => 'Filact_Accountshield_Block_Adminhtml_Lockout_Grid_Renderer_Islocked',
|
112 |
+
));
|
113 |
+
|
114 |
+
$this->addColumn('action',
|
115 |
+
array(
|
116 |
+
'header' => Mage::helper('accountshield')->__('Action'),
|
117 |
+
'width' => '100px',
|
118 |
+
'type' => 'action',
|
119 |
+
'getter' => 'getId',
|
120 |
+
'actions' => array(array(
|
121 |
+
'caption' => Mage::helper('accountshield')->__('Unlock'),
|
122 |
+
'url' => array('base' => '*/*/unlock'),
|
123 |
+
'field' => 'id',
|
124 |
+
'confirm' => Mage::helper('accountshield')->__('Are you sure to unlock this User?')
|
125 |
+
), array(
|
126 |
+
'caption' => Mage::helper('accountshield')->__('Delete'),
|
127 |
+
'url' => array('base' => '*/*/delete'),
|
128 |
+
'field' => 'id',
|
129 |
+
'confirm' => Mage::helper('accountshield')->__('Are you sure to delete this lock?')
|
130 |
+
)),
|
131 |
+
'filter' => false,
|
132 |
+
'sortable' => false,
|
133 |
+
'index' => 'lockout',
|
134 |
+
));
|
135 |
+
|
136 |
+
return parent::_prepareColumns();
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Return row URL for js event handlers
|
141 |
+
*
|
142 |
+
* @return string
|
143 |
+
*/
|
144 |
+
public function getRowUrl($row)
|
145 |
+
{
|
146 |
+
return $this->getUrl('*/*', array('id' => $row->getId()));
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Grid url getter
|
151 |
+
*
|
152 |
+
* @return string current grid url
|
153 |
+
*/
|
154 |
+
public function getGridUrl()
|
155 |
+
{
|
156 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
157 |
+
}
|
158 |
+
}
|
app/code/community/Filact/Accountshield/Block/Adminhtml/Lockout/Grid/Renderer/Islocked.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Adminhtml manage lockout grid - Is Locked column
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Block_Adminhtml_Lockout_Grid_Renderer_Islocked
|
23 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Renders column
|
27 |
+
*
|
28 |
+
* @param Varien_Object $row
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function render(Varien_Object $row)
|
32 |
+
{
|
33 |
+
$html = Mage::helper('accountshield')->__('No');
|
34 |
+
|
35 |
+
$lockoutModel = Mage::getModel('accountshield/lockout')->load($row->getId());
|
36 |
+
|
37 |
+
$lastFailureAt = $lockoutModel->getLastFailureAt();
|
38 |
+
if (($lockoutModel->getCurFailureNum() >= $lockoutModel->getMaxLimit()) && $lockoutModel->remTime($lastFailureAt))
|
39 |
+
$html = Mage::helper('accountshield')->__('Yes');
|
40 |
+
|
41 |
+
return $html;
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Filact/Accountshield/Helper/Admin.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Adminhtml helper
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Helper_Admin extends Mage_Core_Helper_Abstract
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Check permission for passed action
|
26 |
+
*
|
27 |
+
* @param string $action
|
28 |
+
* @return bool
|
29 |
+
*/
|
30 |
+
public function isActionAllowed($action)
|
31 |
+
{
|
32 |
+
if ($action)
|
33 |
+
return Mage::getSingleton('admin/session')->isAllowed('accountshield/manage/' . $action);
|
34 |
+
else
|
35 |
+
return Mage::getSingleton('admin/session')->isAllowed('accountshield/manage');
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Filact/Accountshield/Helper/Data.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Default helper
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Helper_Data extends Mage_Core_Helper_Abstract
|
23 |
+
{
|
24 |
+
}
|
app/code/community/Filact/Accountshield/Model/Lockout.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Lockout model
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Model_Lockout extends Mage_Core_Model_Abstract
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Frontend lockout flag
|
26 |
+
*
|
27 |
+
* @var integer
|
28 |
+
*/
|
29 |
+
const FRONTEND_LOGIN = 1;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Adminhtml lockout flag
|
33 |
+
*
|
34 |
+
* @var integer
|
35 |
+
*/
|
36 |
+
const ADMINHTML_LOGIN = 2;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Check lockout enabled or not - System Configuration
|
40 |
+
*
|
41 |
+
* @var boolean
|
42 |
+
*/
|
43 |
+
const ENABLED = 'accountshield/account/enable';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Maximum allowed login attempts - System Configuration
|
47 |
+
*
|
48 |
+
* @var integer
|
49 |
+
*/
|
50 |
+
const MAX_LIMIT = 'accountshield/account/max_limit';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Account lock duration in seconds - System Configuration
|
54 |
+
*
|
55 |
+
* @var integer
|
56 |
+
*/
|
57 |
+
const INTERVAL = 'accountshield/account/interval';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Define resource model
|
61 |
+
*/
|
62 |
+
protected function _construct()
|
63 |
+
{
|
64 |
+
$this->_init('accountshield/lockout');
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Assign created_at and updated_at fields
|
69 |
+
*
|
70 |
+
* @return Filact_Accountshield_Model_Lockout
|
71 |
+
*/
|
72 |
+
protected function _beforeSave()
|
73 |
+
{
|
74 |
+
parent::_beforeSave();
|
75 |
+
|
76 |
+
if ($this->isObjectNew()) {
|
77 |
+
$this->setData('created_at', Varien_Date::now());
|
78 |
+
} else {
|
79 |
+
$this->setData('updated_at', Varien_Date::now());
|
80 |
+
}
|
81 |
+
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Check lockout enabled or not - System Configuration
|
87 |
+
*
|
88 |
+
* @return boolean
|
89 |
+
*/
|
90 |
+
public function isEnabled() {
|
91 |
+
return Mage::getStoreConfig(self::ENABLED);
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Maximum allowed login attempts - System Configuration
|
96 |
+
*
|
97 |
+
* @return integer
|
98 |
+
*/
|
99 |
+
public function getMaxLimit() {
|
100 |
+
return is_numeric(Mage::getStoreConfig(self::MAX_LIMIT)) ? Mage::getStoreConfig(self::MAX_LIMIT) : 3;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Account lock duration in seconds - System Configuration
|
105 |
+
*
|
106 |
+
* @return integer
|
107 |
+
*/
|
108 |
+
public function getInterval() {
|
109 |
+
return is_numeric(Mage::getStoreConfig(self::INTERVAL)) ? Mage::getStoreConfig(self::INTERVAL) : 900;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Check whether a lockout time has been expired.
|
114 |
+
*
|
115 |
+
* @param timestamp $time
|
116 |
+
* @return boolean
|
117 |
+
*/
|
118 |
+
public function isIntervalExceeds($time) {
|
119 |
+
$isAllow = false;
|
120 |
+
|
121 |
+
if ($time) {
|
122 |
+
$timestamp = Mage::getModel('core/date')->timestamp($time);
|
123 |
+
$now = Mage::getModel('core/date')->timestamp(Varien_Date::now());
|
124 |
+
|
125 |
+
$isAllow = (($this->remTime($time)/60) == 0);
|
126 |
+
}
|
127 |
+
|
128 |
+
exit( 'int: '. ($this->remTime($time)/60));
|
129 |
+
|
130 |
+
return $isAllow;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Check whether a lockout has remaining time to expire.
|
135 |
+
*
|
136 |
+
* @param timestamp $time
|
137 |
+
* @return timestamp
|
138 |
+
*/
|
139 |
+
public function remTime($time) {
|
140 |
+
$rem = 0;
|
141 |
+
|
142 |
+
if ($time) {
|
143 |
+
$timestamp = Mage::getModel('core/date')->timestamp($time);
|
144 |
+
$endTime = $timestamp + $this->getInterval();
|
145 |
+
$now = Mage::getModel('core/date')->timestamp(Varien_Date::now());
|
146 |
+
|
147 |
+
$rem = intval($endTime - $now);
|
148 |
+
$rem = ($rem<0) ? 0 : $rem;
|
149 |
+
}
|
150 |
+
|
151 |
+
return $rem;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Get a frontend lockout flag
|
156 |
+
*
|
157 |
+
* @return integer
|
158 |
+
*/
|
159 |
+
public function getFrontendLoginId() {
|
160 |
+
return self::FRONTEND_LOGIN;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Get a Adminhtml lockout flag
|
165 |
+
*
|
166 |
+
* @return integer
|
167 |
+
*/
|
168 |
+
public function getAdminhtmlLoginId() {
|
169 |
+
return self::ADMINHTML_LOGIN;
|
170 |
+
}
|
171 |
+
}
|
app/code/community/Filact/Accountshield/Model/Observer.php
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Lockout observer model
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Model_Observer
|
23 |
+
{
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Frontend login attempts log and lockout process
|
27 |
+
*
|
28 |
+
* @param Varien_Event_Observer
|
29 |
+
* @return Filact_Accountshield_Model_Lockout
|
30 |
+
*/
|
31 |
+
public function accountLock(Varien_Event_Observer $observer) {
|
32 |
+
|
33 |
+
$controller = $observer->getControllerAction();
|
34 |
+
|
35 |
+
$sourceModel = Mage::getModel('accountshield/lockout');
|
36 |
+
if (!$sourceModel->isEnabled())
|
37 |
+
return $this;
|
38 |
+
|
39 |
+
if ($controller->getFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH))
|
40 |
+
return $this;
|
41 |
+
|
42 |
+
$session = Mage::getSingleton('customer/session');
|
43 |
+
$customer = Mage::getModel('customer/customer')
|
44 |
+
->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
|
45 |
+
|
46 |
+
if (Mage::app()->getRequest()->isPost()) {
|
47 |
+
$login = Mage::app()->getRequest()->getPost('login');
|
48 |
+
|
49 |
+
if (!empty($login['username']) && !empty($login['password'])) {
|
50 |
+
|
51 |
+
// Customer exists check
|
52 |
+
$checkCustomer = $customer->loadByEmail($login['username']);
|
53 |
+
if (!$checkCustomer->getId())
|
54 |
+
return $this;
|
55 |
+
|
56 |
+
$lockoutModel = Mage::getModel('accountshield/lockout')->getCollection()
|
57 |
+
->addFieldToFilter('username', $login['username'])
|
58 |
+
->addFieldToFilter('website_id', Mage::app()->getStore()->getWebsiteId())
|
59 |
+
->getFirstItem();
|
60 |
+
|
61 |
+
$lastFailureAt = $lockoutModel->getLastFailureAt();
|
62 |
+
|
63 |
+
if (($lockoutModel->getCurFailureNum() >= $lockoutModel->getMaxLimit()) && $lockoutModel->remTime($lastFailureAt)) {
|
64 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('*/*'));
|
65 |
+
Mage::getSingleton('customer/session')->addError(Mage::helper('core')->__('Your account has been locked!. Please try again after %d Mins', ceil($lockoutModel->remTime($lastFailureAt)/60)));
|
66 |
+
Mage::app()->getResponse()->sendResponse();
|
67 |
+
exit;
|
68 |
+
}
|
69 |
+
|
70 |
+
try {
|
71 |
+
$customer->authenticate($login['username'], $login['password']);
|
72 |
+
} catch (Mage_Core_Exception $e) {
|
73 |
+
|
74 |
+
$failureNum = $lockoutModel->getFailuresNum() + 1;
|
75 |
+
$curFailureNum = $lockoutModel->getCurFailureNum() + 1;
|
76 |
+
|
77 |
+
// Reset again
|
78 |
+
if (($lockoutModel->getCurFailureNum() >= $lockoutModel->getMaxLimit()) && !$lockoutModel->remTime($lastFailureAt))
|
79 |
+
$curFailureNum = 1;
|
80 |
+
|
81 |
+
$lockoutModel->setUsername($login['username']);
|
82 |
+
$lockoutModel->setFailuresNum($failureNum);
|
83 |
+
$lockoutModel->setCurFailureNum($curFailureNum);
|
84 |
+
$lockoutModel->setLastFailureAt(Varien_Date::now());
|
85 |
+
$lockoutModel->setType($lockoutModel->getFrontendLoginId());
|
86 |
+
$lockoutModel->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
|
87 |
+
$lockoutModel->save();
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
return $this;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Release frontend account lock
|
97 |
+
*
|
98 |
+
* @param Varien_Event_Observer
|
99 |
+
* @return Filact_Accountshield_Model_Lockout
|
100 |
+
*/
|
101 |
+
public function accountLockRelease(Varien_Event_Observer $observer) {
|
102 |
+
|
103 |
+
$sourceModel = Mage::getModel('accountshield/lockout');
|
104 |
+
if (!$sourceModel->isEnabled())
|
105 |
+
return $this;
|
106 |
+
|
107 |
+
$customer = $observer->getCustomer();
|
108 |
+
|
109 |
+
if ($customer->getEmail()) {
|
110 |
+
$lockoutModel = Mage::getModel('accountshield/lockout')->getCollection()
|
111 |
+
->addFieldToFilter('username', $customer->getEmail())
|
112 |
+
->addFieldToFilter('website_id', Mage::app()->getStore()->getWebsiteId())
|
113 |
+
->getFirstItem();
|
114 |
+
|
115 |
+
if ($lockoutModel->getId()) {
|
116 |
+
$lognum = $lockoutModel->getLognum() + 1;
|
117 |
+
|
118 |
+
$lockoutModel->setLognum($lognum);
|
119 |
+
$lockoutModel->setCurFailureNum(0);
|
120 |
+
|
121 |
+
$lockoutModel->save();
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
return $this;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Adminhtml login attempts log and lockout process
|
130 |
+
*
|
131 |
+
* @param Varien_Event_Observer
|
132 |
+
* @return Filact_Accountshield_Model_Lockout
|
133 |
+
*/
|
134 |
+
public function adminAccountLock(Varien_Event_Observer $observer) {
|
135 |
+
|
136 |
+
$sourceModel = Mage::getModel('accountshield/lockout');
|
137 |
+
if (!$sourceModel->isEnabled())
|
138 |
+
return $this;
|
139 |
+
|
140 |
+
$username = $observer->getUsername();
|
141 |
+
$result = $observer->getResult();
|
142 |
+
|
143 |
+
// Check admin user exists
|
144 |
+
$adminUser = Mage::getSingleton('admin/user')->loadByUsername($username);
|
145 |
+
if (!$adminUser->getId())
|
146 |
+
return $this;
|
147 |
+
|
148 |
+
$lockoutModel = Mage::getModel('accountshield/lockout')->getCollection()
|
149 |
+
->addFieldToFilter('username', $username)
|
150 |
+
->addFieldToFilter('type', 2)
|
151 |
+
->getFirstItem();
|
152 |
+
|
153 |
+
$lastFailureAt = $lockoutModel->getLastFailureAt();
|
154 |
+
|
155 |
+
if (($lockoutModel->getCurFailureNum() >= $lockoutModel->getMaxLimit()) && $lockoutModel->remTime($lastFailureAt)) {
|
156 |
+
Mage::throwException(Mage::helper('accountshield')->__('Your account has been locked!. Please try again after %d Mins', ceil($lockoutModel->remTime($lastFailureAt)/60)));
|
157 |
+
}
|
158 |
+
|
159 |
+
if (!$result) {
|
160 |
+
$failureNum = $lockoutModel->getFailuresNum() + 1;
|
161 |
+
$curFailureNum = $lockoutModel->getCurFailureNum() + 1;
|
162 |
+
|
163 |
+
// Reset again
|
164 |
+
if (($lockoutModel->getCurFailureNum() >= $lockoutModel->getMaxLimit()) && !$lockoutModel->remTime($lastFailureAt))
|
165 |
+
$curFailureNum = 1;
|
166 |
+
|
167 |
+
$lockoutModel->setUsername($username);
|
168 |
+
$lockoutModel->setFailuresNum($failureNum);
|
169 |
+
$lockoutModel->setCurFailureNum($curFailureNum);
|
170 |
+
$lockoutModel->setLastFailureAt(Varien_Date::now());
|
171 |
+
$lockoutModel->setType($lockoutModel->getAdminhtmlLoginId());
|
172 |
+
$lockoutModel->setWebstieId(Mage::app()->getStore()->getWebsiteId());
|
173 |
+
$lockoutModel->save();
|
174 |
+
}
|
175 |
+
|
176 |
+
return $this;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Release Adminhtml account lock
|
181 |
+
*
|
182 |
+
* @param Varien_Event_Observer
|
183 |
+
* @return Filact_Accountshield_Model_Lockout
|
184 |
+
*/
|
185 |
+
public function adminAccountLockRelease(Varien_Event_Observer $observer) {
|
186 |
+
|
187 |
+
$sourceModel = Mage::getModel('accountshield/lockout');
|
188 |
+
if (!$sourceModel->isEnabled())
|
189 |
+
return $this;
|
190 |
+
|
191 |
+
$customer = $observer->getUser();
|
192 |
+
|
193 |
+
if ($customer->getUsername()) {
|
194 |
+
$lockoutModel = Mage::getModel('accountshield/lockout')->getCollection()
|
195 |
+
->addFieldToFilter('username', $customer->getUsername())
|
196 |
+
->addFieldToFilter('type', 2)
|
197 |
+
->getFirstItem();
|
198 |
+
|
199 |
+
if ($lockoutModel->getId()) {
|
200 |
+
$lognum = $lockoutModel->getLognum() + 1;
|
201 |
+
|
202 |
+
$lockoutModel->setLognum($lognum);
|
203 |
+
$lockoutModel->setCurFailureNum(0);
|
204 |
+
|
205 |
+
$lockoutModel->save();
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
return $this;
|
210 |
+
}
|
211 |
+
}
|
app/code/community/Filact/Accountshield/Model/Resource/Lockout.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Lockout resource model
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Model_Resource_Lockout extends Mage_Core_Model_Resource_Db_Abstract
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Define resource table
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
protected function _construct()
|
29 |
+
{
|
30 |
+
$this->_init('accountshield/lockout', 'id');
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Filact/Accountshield/Model/Resource/Lockout/Collection.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Lockout collection model
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/class Filact_Accountshield_Model_Resource_Lockout_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Define collection model
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
$this->_init('accountshield/lockout');
|
29 |
+
}
|
30 |
+
}
|
app/code/community/Filact/Accountshield/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Lockout setup model
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
|
23 |
+
{
|
24 |
+
}
|
app/code/community/Filact/Accountshield/controllers/Adminhtml/LockoutController.php
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Adminhtml account lockout controller
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Filact_Accountshield_Adminhtml_LockoutController extends Mage_Adminhtml_Controller_Action
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Init actions
|
26 |
+
*
|
27 |
+
* @return Filact_Accountshield_Adminhtml_LockoutController
|
28 |
+
*/
|
29 |
+
protected function _initAction()
|
30 |
+
{
|
31 |
+
// load layout, set active menu and breadcrumbs
|
32 |
+
$this->loadLayout()
|
33 |
+
->_setActiveMenu('accountshield')
|
34 |
+
->_addBreadcrumb(
|
35 |
+
Mage::helper('accountshield')->__('Lockouts'),
|
36 |
+
Mage::helper('accountshield')->__('Lockouts')
|
37 |
+
)
|
38 |
+
->_addBreadcrumb(
|
39 |
+
Mage::helper('accountshield')->__('Manage Lockouts'),
|
40 |
+
Mage::helper('accountshield')->__('Manage Lockouts')
|
41 |
+
)
|
42 |
+
;
|
43 |
+
return $this;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Index action
|
48 |
+
*/
|
49 |
+
public function indexAction()
|
50 |
+
{
|
51 |
+
$this->_title(Mage::helper('accountshield')->__('Lockouts'))
|
52 |
+
->_title(Mage::helper('accountshield')->__('Manage Lockouts'));
|
53 |
+
|
54 |
+
$this->_initAction();
|
55 |
+
$this->renderLayout();
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Delete action
|
60 |
+
*/
|
61 |
+
public function deleteAction()
|
62 |
+
{
|
63 |
+
$itemId = $this->getRequest()->getParam('id');
|
64 |
+
if ($itemId) {
|
65 |
+
try {
|
66 |
+
|
67 |
+
$model = Mage::getModel('accountshield/lockout');
|
68 |
+
$model->load($itemId);
|
69 |
+
if (!$model->getId()) {
|
70 |
+
Mage::throwException(Mage::helper('accountshield')->__('Unable to find a lockout item.'));
|
71 |
+
}
|
72 |
+
$model->delete();
|
73 |
+
|
74 |
+
// display success message
|
75 |
+
$this->_getSession()->addSuccess(
|
76 |
+
Mage::helper('accountshield')->__('A lockout item has been deleted.')
|
77 |
+
);
|
78 |
+
} catch (Mage_Core_Exception $e) {
|
79 |
+
$this->_getSession()->addError($e->getMessage());
|
80 |
+
} catch (Exception $e) {
|
81 |
+
$this->_getSession()->addException($e,
|
82 |
+
Mage::helper('accountshield')->__('An error occurred while deleting a lockout item.')
|
83 |
+
);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
// go to grid
|
88 |
+
$this->_redirect('*/*/');
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Delete all account locks
|
93 |
+
*
|
94 |
+
*/
|
95 |
+
public function deleteAllAction() {
|
96 |
+
try {
|
97 |
+
$collection = Mage::getModel('accountshield/lockout')->getCollection();
|
98 |
+
if (!$collection->getSize()) {
|
99 |
+
Mage::throwException(Mage::helper('accountshield')->__('There are no items to delete.'));
|
100 |
+
}
|
101 |
+
|
102 |
+
foreach ($collection as $lockout) {
|
103 |
+
$lockout->delete();
|
104 |
+
}
|
105 |
+
|
106 |
+
// display success message
|
107 |
+
$this->_getSession()->addSuccess(
|
108 |
+
Mage::helper('accountshield')->__('All lockouts have been deleted.')
|
109 |
+
);
|
110 |
+
} catch (Mage_Core_Exception $e) {
|
111 |
+
$this->_getSession()->addError($e->getMessage());
|
112 |
+
} catch (Exception $e) {
|
113 |
+
$this->_getSession()->addException($e,
|
114 |
+
Mage::helper('accountshield')->__('An error occurred while deleting the lockouts.')
|
115 |
+
);
|
116 |
+
}
|
117 |
+
|
118 |
+
// go to grid
|
119 |
+
$this->_redirect('*/*/');
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Unlock an User
|
124 |
+
*
|
125 |
+
**/
|
126 |
+
public function unlockAction() {
|
127 |
+
$itemId = $this->getRequest()->getParam('id');
|
128 |
+
if ($itemId) {
|
129 |
+
try {
|
130 |
+
|
131 |
+
$model = Mage::getModel('accountshield/lockout');
|
132 |
+
$model->load($itemId);
|
133 |
+
if (!$model->getId()) {
|
134 |
+
Mage::throwException(Mage::helper('accountshield')->__('Unable to find a lockout item.'));
|
135 |
+
}
|
136 |
+
$model->setCurFailureNum(0);
|
137 |
+
$model->save();
|
138 |
+
|
139 |
+
// display success message
|
140 |
+
$this->_getSession()->addSuccess(
|
141 |
+
Mage::helper('accountshield')->__('An User has been unlocked.')
|
142 |
+
);
|
143 |
+
} catch (Mage_Core_Exception $e) {
|
144 |
+
$this->_getSession()->addError($e->getMessage());
|
145 |
+
} catch (Exception $e) {
|
146 |
+
$this->_getSession()->addException($e,
|
147 |
+
Mage::helper('accountshield')->__('An error occurred while unlocking an User.')
|
148 |
+
);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
// go to grid
|
153 |
+
$this->_redirect('*/*/');
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Grid ajax action
|
158 |
+
*/
|
159 |
+
public function gridAction()
|
160 |
+
{
|
161 |
+
$this->loadLayout();
|
162 |
+
$this->renderLayout();
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Check ACL
|
167 |
+
*/
|
168 |
+
protected function _isAllowed()
|
169 |
+
{
|
170 |
+
switch ($this->getRequest()->getActionName()) {
|
171 |
+
case 'unlock':
|
172 |
+
return Mage::getSingleton('admin/session')->isAllowed('accountshield/manage/unlock');
|
173 |
+
break;
|
174 |
+
case 'delete':
|
175 |
+
case 'deleteall':
|
176 |
+
return Mage::getSingleton('admin/session')->isAllowed('accountshield/manage/delete');
|
177 |
+
break;
|
178 |
+
default:
|
179 |
+
return Mage::getSingleton('admin/session')->isAllowed('accountshield/manage');
|
180 |
+
break;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
}
|
app/code/community/Filact/Accountshield/etc/adminhtml.xml
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<!--
|
4 |
+
/**
|
5 |
+
* Magento
|
6 |
+
*
|
7 |
+
* NOTICE OF LICENSE
|
8 |
+
*
|
9 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
10 |
+
* that is bundled with this package in the file LICENSE.txt.
|
11 |
+
* It is also available through the world-wide-web at this URL:
|
12 |
+
* http://opensource.org/licenses/osl-3.0.php
|
13 |
+
* If you did not receive a copy of the license and are unable to
|
14 |
+
* obtain it through the world-wide-web, please send an email
|
15 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
|
24 |
+
<config>
|
25 |
+
<menu>
|
26 |
+
<accountshield translate="title" module="accountshield">
|
27 |
+
<depends><module>Filact_Accountshield</module></depends>
|
28 |
+
<title>Account Lockout</title>
|
29 |
+
<action>adminhtml/lockout</action>
|
30 |
+
<sort_order>50</sort_order>
|
31 |
+
</accountshield>
|
32 |
+
</menu>
|
33 |
+
|
34 |
+
<acl>
|
35 |
+
<resources>
|
36 |
+
<all>
|
37 |
+
<title>Allow Everything</title>
|
38 |
+
</all>
|
39 |
+
<admin>
|
40 |
+
<children>
|
41 |
+
<accountshield translate="title" module="accountshield">
|
42 |
+
<title>Account Shield</title>
|
43 |
+
<sort_order>65</sort_order>
|
44 |
+
<children>
|
45 |
+
<manage translate="title">
|
46 |
+
<title>Manage</title>
|
47 |
+
<sort_order>0</sort_order>
|
48 |
+
<children>
|
49 |
+
<unlock translate="title">
|
50 |
+
<title>Unlock</title>
|
51 |
+
<sort_order>0</sort_order>
|
52 |
+
</unlock>
|
53 |
+
<delete translate="title">
|
54 |
+
<title>Delete</title>
|
55 |
+
<sort_order>0</sort_order>
|
56 |
+
</delete>
|
57 |
+
</children>
|
58 |
+
</manage>
|
59 |
+
</children>
|
60 |
+
</accountshield>
|
61 |
+
<system>
|
62 |
+
<children>
|
63 |
+
<config>
|
64 |
+
<children>
|
65 |
+
<accountshield module="accountshield" translate="title">
|
66 |
+
<title>Account Shield</title>
|
67 |
+
<sort_order>99</sort_order>
|
68 |
+
</accountshield>
|
69 |
+
</children>
|
70 |
+
</config>
|
71 |
+
</children>
|
72 |
+
</system>
|
73 |
+
</children>
|
74 |
+
</admin>
|
75 |
+
</resources>
|
76 |
+
</acl>
|
77 |
+
</config>
|
app/code/community/Filact/Accountshield/etc/config.xml
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<!--
|
4 |
+
/**
|
5 |
+
* Magento
|
6 |
+
*
|
7 |
+
* NOTICE OF LICENSE
|
8 |
+
*
|
9 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
10 |
+
* that is bundled with this package in the file LICENSE.txt.
|
11 |
+
* It is also available through the world-wide-web at this URL:
|
12 |
+
* http://opensource.org/licenses/osl-3.0.php
|
13 |
+
* If you did not receive a copy of the license and are unable to
|
14 |
+
* obtain it through the world-wide-web, please send an email
|
15 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
|
24 |
+
<config>
|
25 |
+
<modules>
|
26 |
+
<Filact_Accountshield>
|
27 |
+
<version>1.0.0</version>
|
28 |
+
</Filact_Accountshield>
|
29 |
+
</modules>
|
30 |
+
<global>
|
31 |
+
<helpers>
|
32 |
+
<accountshield>
|
33 |
+
<class>Filact_Accountshield_Helper</class>
|
34 |
+
</accountshield>
|
35 |
+
</helpers>
|
36 |
+
<blocks>
|
37 |
+
<accountshield>
|
38 |
+
<class>Filact_Accountshield_Block</class>
|
39 |
+
</accountshield>
|
40 |
+
</blocks>
|
41 |
+
<models>
|
42 |
+
<accountshield>
|
43 |
+
<class>Filact_Accountshield_Model</class>
|
44 |
+
<resourceModel>accountshield_resource</resourceModel>
|
45 |
+
</accountshield>
|
46 |
+
<accountshield_resource>
|
47 |
+
<class>Filact_Accountshield_Model_Resource</class>
|
48 |
+
<deprecatedNode>accountshield_mysql4</deprecatedNode>
|
49 |
+
<entities>
|
50 |
+
<lockout>
|
51 |
+
<table>accountshield_lockout</table>
|
52 |
+
</lockout>
|
53 |
+
</entities>
|
54 |
+
</accountshield_resource>
|
55 |
+
</models>
|
56 |
+
<resources>
|
57 |
+
<accountshield_setup>
|
58 |
+
<setup>
|
59 |
+
<module>Filact_Accountshield</module>
|
60 |
+
<class>Filact_Accountshield_Model_Resource_Setup</class>
|
61 |
+
</setup>
|
62 |
+
</accountshield_setup>
|
63 |
+
</resources>
|
64 |
+
<events>
|
65 |
+
<controller_action_predispatch_customer_account_loginPost>
|
66 |
+
<observers>
|
67 |
+
<filact_accountshield_model_observer>
|
68 |
+
<type>singleton</type>
|
69 |
+
<class>Filact_Accountshield_Model_Observer</class>
|
70 |
+
<method>accountLock</method>
|
71 |
+
</filact_accountshield_model_observer>
|
72 |
+
</observers>
|
73 |
+
</controller_action_predispatch_customer_account_loginPost>
|
74 |
+
<customer_login>
|
75 |
+
<observers>
|
76 |
+
<filact_accountshield_model_observer_releaselog>
|
77 |
+
<type>singleton</type>
|
78 |
+
<class>Filact_Accountshield_Model_Observer</class>
|
79 |
+
<method>accountLockRelease</method>
|
80 |
+
</filact_accountshield_model_observer_releaselog>
|
81 |
+
</observers>
|
82 |
+
</customer_login>
|
83 |
+
<admin_user_authenticate_after>
|
84 |
+
<observers>
|
85 |
+
<filact_accountshield_model_observer>
|
86 |
+
<type>singleton</type>
|
87 |
+
<class>Filact_Accountshield_Model_Observer</class>
|
88 |
+
<method>adminAccountLock</method>
|
89 |
+
</filact_accountshield_model_observer>
|
90 |
+
</observers>
|
91 |
+
</admin_user_authenticate_after>
|
92 |
+
<admin_session_user_login_success>
|
93 |
+
<observers>
|
94 |
+
<filact_accountshield_model_observer>
|
95 |
+
<type>singleton</type>
|
96 |
+
<class>Filact_Accountshield_Model_Observer</class>
|
97 |
+
<method>adminAccountLockRelease</method>
|
98 |
+
</filact_accountshield_model_observer>
|
99 |
+
</observers>
|
100 |
+
</admin_session_user_login_success>
|
101 |
+
</events>
|
102 |
+
</global>
|
103 |
+
<admin>
|
104 |
+
<routers>
|
105 |
+
<adminhtml>
|
106 |
+
<args>
|
107 |
+
<modules>
|
108 |
+
<Filact_Accountshield before="Mage_Adminhtml">Filact_Accountshield_Adminhtml</Filact_Accountshield>
|
109 |
+
</modules>
|
110 |
+
</args>
|
111 |
+
</adminhtml>
|
112 |
+
</routers>
|
113 |
+
</admin>
|
114 |
+
<adminhtml>
|
115 |
+
<layout>
|
116 |
+
<updates>
|
117 |
+
<filact_accountshield>
|
118 |
+
<file>filact_accountshield.xml</file>
|
119 |
+
</filact_accountshield>
|
120 |
+
</updates>
|
121 |
+
</layout>
|
122 |
+
<translate>
|
123 |
+
<modules>
|
124 |
+
<filact_accountshield>
|
125 |
+
<files>
|
126 |
+
<default>filact_accountshield.csv</default>
|
127 |
+
</files>
|
128 |
+
</filact_accountshield>
|
129 |
+
</modules>
|
130 |
+
</translate>
|
131 |
+
</adminhtml>
|
132 |
+
<frontend>
|
133 |
+
<translate>
|
134 |
+
<modules>
|
135 |
+
<filact_accountshield>
|
136 |
+
<files>
|
137 |
+
<default>filact_accountshield.csv</default>
|
138 |
+
</files>
|
139 |
+
</filact_accountshield>
|
140 |
+
</modules>
|
141 |
+
</translate>
|
142 |
+
</frontend>
|
143 |
+
</config>
|
app/code/community/Filact/Accountshield/etc/system.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<!--
|
4 |
+
/**
|
5 |
+
* Magento
|
6 |
+
*
|
7 |
+
* NOTICE OF LICENSE
|
8 |
+
*
|
9 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
10 |
+
* that is bundled with this package in the file LICENSE.txt.
|
11 |
+
* It is also available through the world-wide-web at this URL:
|
12 |
+
* http://opensource.org/licenses/osl-3.0.php
|
13 |
+
* If you did not receive a copy of the license and are unable to
|
14 |
+
* obtain it through the world-wide-web, please send an email
|
15 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
|
24 |
+
<config>
|
25 |
+
<sections>
|
26 |
+
<accountshield translate="label" module="accountshield">
|
27 |
+
<class>separator-top</class>
|
28 |
+
<label>Account Shield</label>
|
29 |
+
<tab>advanced</tab>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>999</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 |
+
<groups>
|
36 |
+
<account translate="label">
|
37 |
+
<label>Account Lockout</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>1</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
<fields>
|
44 |
+
<enable translate="label">
|
45 |
+
<label>Enable</label>
|
46 |
+
<frontend_type>select</frontend_type>
|
47 |
+
<sort_order>1</sort_order>
|
48 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
</enable>
|
53 |
+
<max_limit translate="label">
|
54 |
+
<label>Threshold</label>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<sort_order>2</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
<comment>Number of consecutive failed signin attempts. (Default is 3)</comment>
|
61 |
+
</max_limit>
|
62 |
+
<interval translate="label">
|
63 |
+
<label>Duration</label>
|
64 |
+
<frontend_type>text</frontend_type>
|
65 |
+
<sort_order>3</sort_order>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>1</show_in_website>
|
68 |
+
<show_in_store>1</show_in_store>
|
69 |
+
<comment>How long an account will remain as locked out. Specity in Seconds (Default is 900 Seconds)</comment>
|
70 |
+
</interval>
|
71 |
+
</fields>
|
72 |
+
</account>
|
73 |
+
</groups>
|
74 |
+
</accountshield>
|
75 |
+
</sections>
|
76 |
+
</config>
|
app/code/community/Filact/Accountshield/sql/accountshield_setup/install-1.0.0.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* Lockout install script
|
16 |
+
*
|
17 |
+
* @category Filact
|
18 |
+
* @package Filact_Accountshield
|
19 |
+
* @copyright Copyright (c) 2014 Filact (http://www.filact.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
25 |
+
*/
|
26 |
+
$installer = $this;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Creating table accountshield_lockout
|
30 |
+
*/
|
31 |
+
$tableName = $installer->getTable('accountshield/lockout');
|
32 |
+
|
33 |
+
if ($installer->getConnection()->isTableExists($tableName) != true) {
|
34 |
+
$table = $installer->getConnection()
|
35 |
+
->newTable($installer->getTable('accountshield/lockout'))
|
36 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
37 |
+
'unsigned' => true,
|
38 |
+
'identity' => true,
|
39 |
+
'nullable' => false,
|
40 |
+
'primary' => true,
|
41 |
+
), 'Primary Id')
|
42 |
+
->addColumn('username', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
43 |
+
'nullable' => false,
|
44 |
+
), 'User name')
|
45 |
+
->addColumn('lognum', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
46 |
+
'nullable' => false,
|
47 |
+
'default' => 0,
|
48 |
+
), 'Total login count')
|
49 |
+
->addColumn('failures_num', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
50 |
+
'nullable' => false,
|
51 |
+
'default' => 0,
|
52 |
+
), 'Total failure count')
|
53 |
+
->addColumn('cur_failure_num', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
54 |
+
'nullable' => false,
|
55 |
+
'default' => 0,
|
56 |
+
), 'Current failure count')
|
57 |
+
->addColumn('last_failure_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
58 |
+
'nullable' => false
|
59 |
+
), 'last failure time')
|
60 |
+
->addColumn('type', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
61 |
+
'nullable' => false,
|
62 |
+
'default' => 0,
|
63 |
+
), 'login type')
|
64 |
+
->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
65 |
+
'nullable' => false,
|
66 |
+
'default' => 0,
|
67 |
+
), 'Website id')
|
68 |
+
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
69 |
+
'nullable' => true,
|
70 |
+
'default' => null,
|
71 |
+
), 'Created time')
|
72 |
+
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
73 |
+
'nullable' => true,
|
74 |
+
'default' => null,
|
75 |
+
), 'Updated time')
|
76 |
+
|
77 |
+
->addIndex($installer->getIdxName(
|
78 |
+
$installer->getTable('accountshield/lockout'),
|
79 |
+
array('id'),
|
80 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX
|
81 |
+
),
|
82 |
+
array('id'),
|
83 |
+
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
84 |
+
)
|
85 |
+
->setComment('Account lockout');
|
86 |
+
|
87 |
+
$installer->getConnection()->createTable($table);
|
88 |
+
}
|
app/design/adminhtml/default/default/layout/Filact_Accountshield.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento backend layout
|
5 |
+
*
|
6 |
+
* @author Magento
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<layout>
|
10 |
+
<adminhtml_lockout_index>
|
11 |
+
<reference name="content">
|
12 |
+
<block type="accountshield/adminhtml_lockout" name="lockouts" />
|
13 |
+
</reference>
|
14 |
+
</adminhtml_lockout_index>
|
15 |
+
|
16 |
+
<adminhtml_lockout_grid>
|
17 |
+
<block type="accountshield/adminhtml_lockout_grid" name="root"/>
|
18 |
+
</adminhtml_lockout_grid>
|
19 |
+
</layout>
|
app/etc/modules/Filact_Accountshield.xml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
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@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Phoenix
|
17 |
+
* @package Phoenix_Moneybookers
|
18 |
+
* @copyright Copyright (c) 2014 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<modules>
|
24 |
+
<Filact_Accountshield>
|
25 |
+
<active>true</active>
|
26 |
+
<codePool>community</codePool>
|
27 |
+
<depends>
|
28 |
+
<Mage_Customer />
|
29 |
+
</depends>
|
30 |
+
</Filact_Accountshield>
|
31 |
+
</modules>
|
32 |
+
</config>
|
app/locale/en_US/Filact_Accountshield.csv
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Account Shield", "Account Shield"
|
2 |
+
"Account Lockout", "Account Lockout"
|
3 |
+
"Enable", "Enable"
|
4 |
+
"Threshold", "Threshold"
|
5 |
+
"Number of consecutive failed signin attempts. (Default is 3)", "Number of consecutive failed signin attempts. (Default is 3)"
|
6 |
+
"Duration", "Duration"
|
7 |
+
"How long an account will remain as locked out. Specity in Seconds (Default is 900 Seconds)", "How long an account will remain as locked out. Specity in Seconds (Default is 900 Seconds)"
|
8 |
+
"Manage", "Manage"
|
9 |
+
"Unlock", "Unlock"
|
10 |
+
"Delete", "Delete"
|
11 |
+
"Manage Account Lockout", "Manage Account Lockout"
|
12 |
+
"Delete All", "Delete All"
|
13 |
+
"Are you sure to delete all locks?", "Are you sure to delete all locks?"
|
14 |
+
"Are you sure?", "Are you sure?"
|
15 |
+
"ID", "ID"
|
16 |
+
"Username", "Username"
|
17 |
+
"Total Login Times", "Total Login Times"
|
18 |
+
"Total Failure Times", "Total Failure Times"
|
19 |
+
"Current Failure Attempts", "Current Failure Attempts"
|
20 |
+
"Last Failure At", "Last Failure At"
|
21 |
+
"Website", "Website"
|
22 |
+
"Is Locked?", "Is Locked?"
|
23 |
+
"Action", "Action"
|
24 |
+
"Unlock", "Unlock"
|
25 |
+
"Are you sure to unlock this User?", "Are you sure to unlock this User?"
|
26 |
+
"Delete", "Delete"
|
27 |
+
"Are you sure to delete this lock?", "Are you sure to delete this lock?"
|
28 |
+
"No", "No"
|
29 |
+
"Yes", "Yes"
|
30 |
+
"Lockouts", "Lockouts"
|
31 |
+
"Manage Lockouts", "Manage Lockouts"
|
32 |
+
"Unable to find a lockout item.", "Unable to find a lockout item."
|
33 |
+
"A lockout item has been deleted.", "A lockout item has been deleted."
|
34 |
+
"An error occurred while deleting a lockout item.", "An error occurred while deleting a lockout item."
|
35 |
+
"There are no items to delete.", "There are no items to delete."
|
36 |
+
"All lockouts have been deleted.", "All lockouts have been deleted."
|
37 |
+
"An error occurred while deleting the lockouts.", "An error occurred while deleting the lockouts."
|
38 |
+
"An User has been unlocked.", "An User has been unlocked."
|
39 |
+
"An error occurred while unlocking an User.", "An error occurred while unlocking an User."
|
40 |
+
"Your account has been locked!. Please try again after %d Mins", "Your account has been locked!. Please try again after %d Mins"
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Filact_Accountshield</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Implements Account Lockout to enhance the User authentication security</summary>
|
10 |
+
<description>Implements Account Lockout to enhance the User authentication security.</description>
|
11 |
+
<notes>First release</notes>
|
12 |
+
<authors><author><name>Karuppusamy Ganesan</name><user>filact</user><email>admin@filact.com</email></author></authors>
|
13 |
+
<date>2014-08-08</date>
|
14 |
+
<time>06:47:46</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Filact_Accountshield.xml" hash="aceae1e75936de6bab448d100894cb83"/></dir></target><target name="magecommunity"><dir name="Filact"><dir name="Accountshield"><dir name="Block"><dir name="Adminhtml"><dir name="Lockout"><dir name="Grid"><dir name="Renderer"><file name="Islocked.php" hash="166630252663dc12f12bc117a528a72b"/></dir></dir><file name="Grid.php" hash="8a2992b6202046d9d3e02ef4459b8a09"/></dir><file name="Lockout.php" hash="7da457a7866abf553ac72d9d1764f0a2"/></dir></dir><dir name="Helper"><file name="Admin.php" hash="a25fcc48072a0b9e17ee6082566c3d0d"/><file name="Data.php" hash="53085f34e9bfc20b4b32390fd1a221e7"/></dir><dir name="Model"><file name="Lockout.php" hash="240ca9aa30bd967380deaf3f21a045c5"/><file name="Observer.php" hash="b182a2dfe0ccd66fb6f24278f2b48d9c"/><dir name="Resource"><dir name="Lockout"><file name="Collection.php" hash="bf90df2e00c2b4e0b46b2fb19c1b6449"/></dir><file name="Lockout.php" hash="587cc6aed8cf861d415ea6d9d036a231"/><file name="Setup.php" hash="e1fcd3b8d8df1b947fd7d61e98ed9cf6"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LockoutController.php" hash="79e4b0bbfaa7246d9a410bed553a2c0c"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="004cca1a143ba7eb9ea9b0f5a4629540"/><file name="config.xml" hash="b0e6009d3483b02f8b2091cb8cbf9824"/><file name="system.xml" hash="4cd61e70b83d77a07bd941da45dc9284"/></dir><dir name="sql"><dir name="accountshield_setup"><file name="install-1.0.0.php" hash="d047794d3fac61fd3f92f0a99bd8f289"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="Filact_Accountshield.xml" hash="bd958711afa231f95ef8eb54daa6b0df"/></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Filact_Accountshield.csv" hash="e44cf77fa99b468856a4ce623160ab63"/></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.9.0.1</max></package></required></dependencies>
|
18 |
+
</package>
|