Fix for 0 minutes
This commit is contained in:
@@ -820,9 +820,14 @@ class FrontControllerCore extends Controller
|
||||
|
||||
if ($attemptsCount >= $maxAttempts) {
|
||||
if ($lastAttempt = $objMaintenanceAccess->getLastAttempt($email, $remoteIpAddress)) {
|
||||
$minutesElapsed = round((time() - strtotime($lastAttempt['date_add'])) / 60);
|
||||
$minutesElapsed = (int) ((time() - strtotime($lastAttempt['date_add'])) / 60);
|
||||
$minutesLeft = MaintenanceAccess::LOGIN_ATTEMPTS_WINDOW - $minutesElapsed;
|
||||
|
||||
$this->errors[] = Tools::displayError(sprintf('You have reached the limit of login attempts, please try after %d minutes.', MaintenanceAccess::LOGIN_ATTEMPTS_WINDOW - $minutesElapsed));
|
||||
if ($minutesLeft > 1) {
|
||||
$this->errors[] = Tools::displayError(sprintf('You have reached the limit of login attempts, please try after %d minutes.', $minutesLeft));
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError(sprintf('You have reached the limit of login attempts, please try after 1 minute.', $minutesLeft));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class AdminMaintenanceControllerCore extends AdminController
|
||||
'cast' => 'intval',
|
||||
'type' => 'text',
|
||||
'class' => 'fixed-width-xl',
|
||||
'desc' => $this->l('Set the number of maximum login attempts allowed in 30 minutes.'),
|
||||
'desc' => sprintf($this->l('Set the number of maximum login attempts allowed in %d minutes.'), MaintenanceAccess::LOGIN_ATTEMPTS_WINDOW),
|
||||
'form_group_class' => ((Tools::getValue('PS_SHOP_ENABLE', Configuration::get('PS_SHOP_ENABLE'))) || !(Tools::getValue('PS_ALLOW_EMP', Configuration::get('PS_ALLOW_EMP')))) ? ' collapse' : '',
|
||||
),
|
||||
'PS_MAINTENANCE_IP' => array(
|
||||
|
||||
Reference in New Issue
Block a user