diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 586e6d9dfa..d55808b09b 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -482,12 +482,16 @@ if (isset($correct_reset_pass_process)) { if (isset($login_failed)) { $nick = io_safe_input(get_parameter_post('nick')); - $fails = db_get_value('failed_attempt', 'tusuario', 'id_user', $nick); - + $user_in_db = db_get_row_filter( + 'tusuario', + ['id_user' => $nick], + '*' + ); + $fails = $user_in_db['failed_attempt']; // If user not exist, and attempts its enable, lets make array and fails attemps. - if ($fails == false && $config['enable_pass_policy']) { + if ($fails == false && $config['enable_pass_policy'] && $user_in_db === false) { $nick_array_error = json_decode(base64_decode($config['nicks_error']), true); - + $nick = strtolower($nick); if (isset($nick_array_error[$nick]) !== false) { $nick_array_error[$nick] += 1; } else { @@ -495,11 +499,14 @@ if (isset($login_failed)) { } $fails = $nick_array_error[$nick]; + // Save or update the array. if ($config['nicks_error']) { config_update_value('nicks_error', base64_encode(json_encode($nick_array_error))); } else { config_create_value('nicks_error', base64_encode(json_encode($nick_array_error))); } + } else { + $fails = ++$fails; } $attemps = ($config['number_attempts'] - $fails); @@ -516,7 +523,12 @@ if (isset($login_failed)) { echo ''; if ($config['enable_pass_policy']) { echo '
'; } diff --git a/pandora_console/mobile/include/ui.class.php b/pandora_console/mobile/include/ui.class.php index af9f4d7a95..3d330994cf 100755 --- a/pandora_console/mobile/include/ui.class.php +++ b/pandora_console/mobile/include/ui.class.php @@ -744,7 +744,7 @@ class Ui $dialogHtml .= "