Minor cosmetic changes

Reworked CSRF error message
This commit is contained in:
Luca Deri 2016-12-04 11:00:23 +01:00
parent e6e3f065b4
commit 71a0993022
6 changed files with 60 additions and 39 deletions

View file

@ -4,7 +4,7 @@
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
if ( (dirs.scriptdir ~= nil) and (dirs.scriptdir ~= "")) then package.path = dirs.scriptdir .. "/lua/modules/?.lua;" .. package.path end
if((dirs.scriptdir ~= nil) and (dirs.scriptdir ~= "")) then package.path = dirs.scriptdir .. "/lua/modules/?.lua;" .. package.path end
require "lua_utils"
require "prefs_utils"
@ -80,8 +80,8 @@ if (subpage_active == "logging") then
end
end
-- ================================================================================
function printReportVisualization()
print('<form>')
print('<input type=hidden name="subpage_active" value="report"/>\n')
@ -98,6 +98,7 @@ function printReportVisualization()
end
-- ================================================================================
function printInterfaces()
print('<form>')
print('<input type=hidden name="subpage_active" value="ifaces"/>\n')
@ -114,6 +115,7 @@ function printInterfaces()
end
-- ================================================================================
function printTopTalkers()
print('<form>')
print('<input type=hidden name="subpage_active" value="top_talkers"/>\n')
@ -164,11 +166,21 @@ function printAlerts()
print('<table class="table">')
print('<tr><th colspan=2 class="info">Alerts</th></tr>')
if ntop.getPref("ntopng.prefs.disable_alerts_generation") == "1" then
showElements = true
else
showElements = false
end
local elementToSwitch = { "max_num_alerts_per_entity", "toggle_alert_probing", "toggle_malware_probing", "toggle_alert_syslog" }
toggleTableButtonPrefs("Enable Alerts",
"Toggle the overall generation of alerts.",
"On", "0", "success", -- On means alerts enabled and thus disable_alerts_generation == 0
"Off", "1", "danger", -- Off for enabled alerts implies 1 for disable_alerts_generation
"disable_alerts_generation", "ntopng.prefs.disable_alerts_generation", "0")
"disable_alerts_generation", "ntopng.prefs.disable_alerts_generation", "0",
showElements==false,
elementToSwitch)
if ntop.getPrefs().are_alerts_enabled == true then
showElements = true
@ -180,7 +192,7 @@ function printAlerts()
"The maximum number of alerts per alarmable entity. Alarmable entities are hosts, networks, interfaces and flows. "..
"Once the maximum number of entity alerts is reached, new alerts raised by the same entities will be discarded. "..
"Default: 1024.", "ntopng.prefs.", "max_num_alerts_per_entity", prefs.max_num_alerts_per_entity, nil, showElements, false)
toggleTableButtonPrefs("Enable Probing Alerts",
"Enable alerts generated when probing attempts are detected.",
"On", "1", "success",
@ -188,12 +200,14 @@ function printAlerts()
"toggle_alert_probing", "ntopng.prefs.probing_alerts", "1",
showElements == false)
if(false) then
toggleTableButtonPrefs("Enable Hosts Malware Blacklists",
"Enable alerts generated by traffic sent/received by malware-marked hosts.",
"On", "enabled", "success",
"Off","disabled", "danger",
"toggle_malware_probing", "ntopng.prefs.host_blacklist", "1",
showElements == false)
end
toggleTableButtonPrefs("Alerts On Syslog",
"Enable alerts logging on system syslog.",
@ -221,7 +235,7 @@ function printAlerts()
local labels = {"Errors","Errors and Warnings","All"}
local values = {"only_errors","errors_and_warnings","all_alerts"}
local retVal = multipleTableButtonPrefs("Notification Preference Based On Severity",
"Errors (errors only), Errors and Warnings (errors and warnings, no info), All (every kind of alerts will be notified).",
labels, values, "only_errors", "primary", "slack_notification_severity_preference", "ntopng.prefs.slack_alert_severity", nil, nil, nil, nil, showElements and showSlackNotificationPrefs)
@ -236,22 +250,22 @@ function printAlerts()
if (ntop.isPro()) then
print('<tr><th colspan=2 class="info">Nagios Integration</th></tr>')
local elementToSwitch = {"nagios_nsca_host","nagios_nsca_port","nagios_send_nsca_executable","nagios_send_nsca_config","nagios_host_name","nagios_service_name"}
toggleTableButtonPrefs("Alerts To Nagios",
"Enable sending ntopng alerts to Nagios NSCA (Nagios Service Check Acceptor).",
"On", "1", "success",
"Off", "0", "danger",
"toggle_alert_nagios", "ntopng.prefs.alerts_nagios", "0",
showElements,
elementToSwitch)
if ntop.getPref("ntopng.prefs.alerts_nagios") == "1" then
showElements = true
else
showElements = false
end
local elementToSwitch = {"nagios_nsca_host","nagios_nsca_port","nagios_send_nsca_executable","nagios_send_nsca_config","nagios_host_name","nagios_service_name"}
toggleTableButtonPrefs("Send Alerts To Nagios",
"Enable sending ntopng alerts to Nagios NSCA (Nagios Service Check Acceptor).",
"On", "1", "success",
"Off", "0", "danger",
"toggle_alert_nagios", "ntopng.prefs.alerts_nagios", "0",
showElements==false,
elementToSwitch)
prefsInputFieldPrefs("Nagios NSCA Host", "Address of the host where the Nagios NSCA daemon is running. Default: localhost.", "ntopng.prefs.", "nagios_nsca_host", prefs.nagios_nsca_host, nil, showElements, false)
prefsInputFieldPrefs("Nagios NSCA Port", "Port where the Nagios daemon's NSCA is listening. Default: 5667.", "ntopng.prefs.", "nagios_nsca_port", prefs.nagios_nsca_port, nil, showElements, false)
prefsInputFieldPrefs("Nagios send_nsca executable", "Absolute path to the Nagios NSCA send_nsca utility. Default: /usr/local/nagios/bin/send_nsca", "ntopng.prefs.", "nagios_send_nsca_executable", prefs.nagios_send_nsca_executable, nil, showElements, false)
@ -267,6 +281,7 @@ function printAlerts()
end
-- ================================================================================
function printNbox()
print('<form>')
print('<input type=hidden name="subpage_active" value="nbox"/>\n')
@ -297,6 +312,7 @@ function printNbox()
end
-- ================================================================================
function printUsers()
print('<form>')
print('<input type=hidden name="subpage_active" value="users"/>\n')
@ -409,6 +425,7 @@ function printUsers()
end
-- ================================================================================
function printInMemory()
print('<form>')
print('<input type=hidden name="subpage_active" value="in_memory"/>\n')
@ -441,7 +458,7 @@ function printInMemory()
"ntopng.prefs.is_active_local_host_cache_enabled", "0")
prefsInputFieldPrefs("Local Hosts Cache Duration", "Time after which a cached local host is deleted from the cache (sec). "..
"Default: 3600.", "ntopng.prefs.","local_host_cache_duration", prefs.local_host_cache_duration)
print('<tr><th colspan=2 class="info">Hosts Statistics Update Frequency</th></tr>')
prefsInputFieldPrefs("Update frequency in seconds",
"Some host statistics such as throughputs are updated periodically. "..
@ -459,6 +476,7 @@ function printInMemory()
end
-- ================================================================================
function printStatsRrds()
print('<form>')
print('<input type=hidden name="subpage_active" value="on_disk_rrds"/>\n')
@ -468,7 +486,7 @@ function printStatsRrds()
toggleTableButtonPrefs("Traffic Timeseries",
"Toggle the creation of traffic timeseries for local hosts and networks. Turn it off to save storage space.",
"On", "1", "success", "Off", "0", "danger", "toggle_local", "ntopng.prefs.host_rrd_creation", "1")
toggleTableButtonPrefs("Layer-7 Application Timeseries",
"Toggle the creation of nDPI timeseries for local hosts and defined networks. Enable their creation allows you "..
"to keep application protocol statistics at the cost of using more disk space.",
@ -493,7 +511,7 @@ function printStatsRrds()
" will be created an RRD with ingress/egress bytes.",
"On", "1", "success", "Off", "0", "danger", "toggle_flow_rrds", "ntopng.prefs.flow_devices_rrd_creation", "0",
not info["version.enterprise_edition"])
toggleTableButtonPrefs("Category Timeseries",
"Toggle the creation of Category timeseries for local hosts and defined networks. Enabling their creation allows you "..
"to keep persistent traffic category statistics (e.g., social networks, news) at the cost of using more disk space.<br>"..
@ -530,6 +548,7 @@ function printStatsRrds()
end
-- ================================================================================
function printLogging()
if prefs.has_cmdl_trace_lvl then return end
print('<form>')