From 1d7230e9ca20c87fbaea40616b386f9dc039776a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 7 Feb 2023 17:24:40 +0100 Subject: [PATCH] #10294 error login no user register attemps --- pandora_console/general/login_page.php | 27 ++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index bb9fa19185..586e6d9dfa 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -481,9 +481,29 @@ if (isset($correct_reset_pass_process)) { } if (isset($login_failed)) { - $nick = get_parameter_post('nick'); + $nick = io_safe_input(get_parameter_post('nick')); $fails = db_get_value('failed_attempt', 'tusuario', 'id_user', $nick); + + // If user not exist, and attempts its enable, lets make array and fails attemps. + if ($fails == false && $config['enable_pass_policy']) { + $nick_array_error = json_decode(base64_decode($config['nicks_error']), true); + + if (isset($nick_array_error[$nick]) !== false) { + $nick_array_error[$nick] += 1; + } else { + $nick_array_error[$nick] = 1; + } + + $fails = $nick_array_error[$nick]; + 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))); + } + } + $attemps = ($config['number_attempts'] - $fails); + $attemps = ($attemps < 0) ? 0 : $attemps; echo '
'; echo '
'; echo '
'; @@ -787,8 +807,8 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' resizable: true, draggable: true, modal: true, - height: 220, - width: 528, + height: 230, + width: 530, overlay: { opacity: 0.5, background: "black" @@ -801,7 +821,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' $("#login_correct_pass").dialog('close'); }); }); - $('#nick').focus(); break; }