mirror of
https://github.com/gophish/gophish
synced 2024-11-12 23:37:11 +00:00
Added error handling to in-app reporting mechanism
This commit is contained in:
parent
ac9e6a7190
commit
8e79294413
2 changed files with 19 additions and 7 deletions
2
static/js/dist/app/campaign_results.min.js
vendored
2
static/js/dist/app/campaign_results.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -935,13 +935,25 @@ function report_mail(rid, cid) {
|
|||
api.campaignId.get(cid).success((function(c) {
|
||||
report_url = new URL(c.url)
|
||||
report_url.pathname = '/report'
|
||||
report_url.search = "?rid=" + rid
|
||||
$.ajax({
|
||||
url: report_url,
|
||||
method: "GET",
|
||||
success: function(data) {
|
||||
refresh();
|
||||
report_url.search = "?rid=" + rid
|
||||
fetch(report_url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
}
|
||||
refresh();
|
||||
})
|
||||
.catch(error => {
|
||||
let errorMessage = error.message;
|
||||
if (error.message === "Failed to fetch") {
|
||||
errorMessage = "This might be due to Mixed Content issues or network problems.";
|
||||
}
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: errorMessage,
|
||||
type: 'error',
|
||||
confirmButtonText: 'Close'
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue