Added a modal when try to open external links (Issue #5618)

This commit is contained in:
l3wiz 2021-07-02 19:28:33 +02:00
parent 8f52f33e13
commit d24f94d14d
4 changed files with 47 additions and 2 deletions

View file

@ -358,6 +358,16 @@ local modals = {
cancel = i18n("cancel"),
apply = i18n("label")
}
}),
["external-link"] = template_utils.gen("pages/modals/alerts/redirect_modal.template", {
dialog={
id = "external-link",
title = i18n("external_link"),
message = i18n("show_alerts.confirm_external_link"),
message2= i18n("are_you_sure"),
cancel = i18n("cancel"),
apply = i18n("redirect")
}
})
}

View file

@ -48,8 +48,9 @@ end
function alert_suspicious_file_transfer.format(ifid, alert, alert_type_params)
local res = i18n("alerts_dashboard.suspicious_file_transfer")
local url = alert_type_params["protos.http.last_url"]
local href = '<a href=http://' .. url .. ' target="_blank"><i class="fas fa-external-link-alt"></i></a>'
local href = '<a id="external-link-href" data-bs-toggle="modal" href="#external-link"><i class="fas fa-external-link-alt"></i></a>'
local info = ""
local tmp = "<div id='tmpUrl' title='".. url .."' class='d-none'></div>"
if alert_type_params and alert_type_params["protos.http.last_url"] then
local type_icon = ''
@ -71,6 +72,7 @@ function alert_suspicious_file_transfer.format(ifid, alert, alert_type_params)
type_icon = type_icon,
info = info,
href = href,
tmp = tmp,
})
end