diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 67053ab0be..43b90aaeb2 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -701,7 +701,13 @@ function delete_user($id_user) function update_user_password($user, $password_new) { global $config; - if (isset($config['auth']) && $config['auth'] == 'pandora') { + + if (excludedPassword($password_new) === true) { + $config['auth_error'] = __('The password provided is not valid. Please, set another one.'); + return false; + } + + if (isset($config['auth']) === true && $config['auth'] === 'pandora') { $sql = sprintf( "UPDATE tusuario SET password = '".md5($password_new)."', last_pass_change = '".date('Y-m-d H:i:s', get_system_time())."' WHERE id_user = '".$user."'" ); @@ -714,7 +720,7 @@ function update_user_password($user, $password_new) ); $remote_pass_update = db_process_sql($sql, 'affected_rows', $connection); - if (!$remote_pass_update) { + if ((bool) $remote_pass_update === false) { $config['auth_error'] = __('Could not changes password on remote pandora'); return false; } diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index a42fe2e8bc..5e8308eabc 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -211,7 +211,7 @@ if (isset($_GET['modified']) && !$view_mode) { $user_info = $upd_info; } else { if (!$error_msg) { - $error_msg = __('Error updating passwords: '); + $error_msg = __('Error updating passwords: ').($config['auth_error'] ?? ''); } $user_auth_error = $config['auth_error'];