From bf453ab0ef7a8c7f9c742d9eae3cbad4e6d464bb Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 21 Jan 2021 17:09:36 +0100 Subject: [PATCH] Effective command preview (action) --- .../include/javascript/pandora_alerts.js | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/javascript/pandora_alerts.js b/pandora_console/include/javascript/pandora_alerts.js index 389aa15475..f6e8f3857d 100644 --- a/pandora_console/include/javascript/pandora_alerts.js +++ b/pandora_console/include/javascript/pandora_alerts.js @@ -1,4 +1,5 @@ -var original_command = ""; +/* globals $ */ + function parse_alert_command(command, classs) { if (classs == "recovery") { classs = "fields_recovery"; @@ -9,16 +10,20 @@ function parse_alert_command(command, classs) { var nfield = 1; $("." + classs).each(function() { // Only render values different from '' - if ($(this).val() == "") { - nfield++; - - return; - } var field = "_field" + nfield + "_"; - var regex = new RegExp(field, "gi"); - - if ($(this).css("-webkit-text-security") == "disc") { + console.log($(this).val()); + if ($(this).val() == "") { + if ( + classs == "fields_recovery" && + $($(".fields")[nfield - 1]).val() != "" + ) { + command = command.replace( + regex, + "[RECOVER]" + $($(".fields")[nfield - 1]).val() + ); + } + } else if ($(this).css("-webkit-text-security") == "disc") { var hidden_character = "*"; var hidden_string = hidden_character.repeat($(this).val().length);