Fix attempts issue
This commit is contained in:
@@ -38,6 +38,14 @@ class MaintenanceAccessCore extends ObjectModel
|
||||
),
|
||||
);
|
||||
|
||||
public function removeFailedAttempts($email, $ipAddress)
|
||||
{
|
||||
Db::getInstance()->execute(
|
||||
'DELETE FROM `' . _DB_PREFIX_ .'maintenance_access` ma
|
||||
WHERE (ma.`email` = "'.pSQL($email).'" AND ma.`ip_address` = "'.pSQL($ipAddress).'")'
|
||||
);
|
||||
}
|
||||
|
||||
public function getFailedAttemptsCount($email, $ipAddress)
|
||||
{
|
||||
$sql = 'SELECT COUNT(ma.`id_maintenance_access`)
|
||||
|
||||
@@ -867,6 +867,9 @@ class FrontControllerCore extends Controller
|
||||
$cookie->enable_maintenance_view = $this->context->employee->id;
|
||||
$cookie->remote_addr = ip2long($remoteIpAddress);
|
||||
$cookie->write();
|
||||
|
||||
// Reset attempts count on successful login
|
||||
$objMaintenanceAccess->removeFailedAttempts($email, $remoteIpAddress);
|
||||
}
|
||||
|
||||
if (count($this->errors)) {
|
||||
|
||||
Reference in New Issue
Block a user