diff --git a/static/js/src/app/campaign_results.js b/static/js/src/app/campaign_results.js index 0b65d33f..61319a57 100644 --- a/static/js/src/app/campaign_results.js +++ b/static/js/src/app/campaign_results.js @@ -3,7 +3,7 @@ var doPoll = true; // statuses is a helper map to point result statuses to ui classes var statuses = { - "Email Sent": { + "Email Sent"): { slice: "ct-slice-donut-sent", legend: "ct-legend-sent", label: "label-success", @@ -84,12 +84,12 @@ function dismiss() { // Deletes a campaign after prompting the user function deleteCampaign() { swal({ - title: "Are you sure?", - text: "This will delete the campaign. This can't be undone!", + title: T("Are you sure?"), + text: T("This will delete the campaign. This can't be undone!"), type: "warning", animation: false, showCancelButton: true, - confirmButtonText: "Delete Campaign", + confirmButtonText: T("Delete Campaign"), confirmButtonColor: "#428bca", reverseButtons: true, allowOutsideClick: false, @@ -106,8 +106,8 @@ function deleteCampaign() { } }).then(function() { swal( - 'Campaign Deleted!', - 'This campaign has been deleted!', + T('Campaign Deleted!'), + T('This campaign has been deleted!'), 'success' ); $('button:contains("OK")').on('click', function() { @@ -119,12 +119,12 @@ function deleteCampaign() { // Completes a campaign after prompting the user function completeCampaign() { swal({ - title: "Are you sure?", - text: "Gophish will stop processing events for this campaign", + title: T("Are you sure?"), + text: T("Gophish will stop processing events for this campaign"), type: "warning", animation: false, showCancelButton: true, - confirmButtonText: "Complete Campaign", + confirmButtonText: T("Complete Campaign"), confirmButtonColor: "#428bca", reverseButtons: true, allowOutsideClick: false, @@ -141,12 +141,12 @@ function completeCampaign() { } }).then(function() { swal( - 'Campaign Completed!', - 'This campaign has been completed!', + T('Campaign Completed!'), + T('This campaign has been completed!'), 'success' ); $('#complete_button')[0].disabled = true; - $('#complete_button').text('Completed!') + $('#complete_button').text(T('Completed!')) doPoll = false; }) } @@ -209,17 +209,17 @@ function replay(event_idx) { /* Ensure we know where to send the user */ // Prompt for the URL swal({ - title: 'Where do you want the credentials submitted to?', + title: T('Where do you want the credentials submitted to?'), input: 'text', showCancelButton: true, - inputPlaceholder: "http://example.com/login", + inputPlaceholder: T("http://example.com/login"), inputValue: url || "", inputValidator: function(value) { return new Promise(function(resolve, reject) { if (value) { resolve(); } else { - reject('Invalid URL.'); + reject(T('Invalid URL.')); } }); } @@ -246,8 +246,8 @@ function renderTimeline(data) { "position": data[5] } results = '
' + - '
Timeline for ' + escapeHtml(record.first_name) + ' ' + escapeHtml(record.last_name) + - '
Email: ' + escapeHtml(record.email) + '' + + '
'+ T('Timeline for') + ' + escapeHtml(record.first_name) + ' ' + escapeHtml(record.last_name) + + '
' + T('Email') + ': ' + escapeHtml(record.email) + '' + '
' $.each(campaign.timeline, function(i, event) { if (!event.email || event.email == record.email) { @@ -257,19 +257,19 @@ function renderTimeline(data) { results += '
' + '
' + - '
' + escapeHtml(event.message) + + '
' + T(escapeHtml(event.message)) + ' ' + moment(event.time).format('MMMM Do YYYY h:mm a') + '' if (event.details) { if (event.message == "Submitted Data") { results += '
' - results += '
View Details
' + results += ' '+ T('Replay Credentials') + '
' + results += '
' + T('View Details') + '
' } details = JSON.parse(event.details) if (details.payload) { results += '
' results += ' ' - results += ' ' + results += ' ' $.each(Object.keys(details.payload), function(i, param) { if (param == "rid") { return true; @@ -283,9 +283,9 @@ function renderTimeline(data) { results += '' } if (details.error) { - results += '
View Details
' + results += '
'+ T('View Details') + '
' results += '
' - results += 'Error ' + details.error + results += ''+ T('Error') + ' ' + details.error results += '
' } } @@ -312,7 +312,7 @@ function poll() { /* Update the timeline */ var timeline_data = { series: [{ - name: "Events", + name: T("Events"), data: [] }] } @@ -345,7 +345,7 @@ function poll() { meta: status, value: count }) - $("#email_chart_legend").append('
  • ' + status + '
  • ') + $("#email_chart_legend").append('
  • ' + T(status) + '
  • ') }) var email_chart = $("#email_chart") if (email_chart.get(0).__chartist__) { @@ -364,7 +364,7 @@ function poll() { $.each(campaign.results, function(j, result) { if (result.id == rid) { var label = statuses[result.status].label || "label-default"; - rowData[6] = "" + result.status + "" + rowData[6] = "" + T(result.status) + "" resultsTable.row(i).data(rowData).draw(false) if (row.child.isShown()) { row.child(renderTimeline(row.data())) @@ -412,7 +412,7 @@ function load() { $("#loading").hide() $("#campaignResults").show() // Set the title - $("#page-title").text("Results for " + c.name) + $("#page-title").text(T("Results for") + " " + c.name) if (c.status == "Completed") { $('#complete_button')[0].disabled = true; $('#complete_button').text('Completed!'); @@ -437,7 +437,7 @@ function load() { // Setup our graphs var timeline_data = { series: [{ - name: "Events", + name: T("Events"), data: [] }] } @@ -497,7 +497,7 @@ function load() { escapeHtml(result.last_name) || "", escapeHtml(result.email) || "", escapeHtml(result.position) || "", - "" + result.status + "" + "" + T(result.status) + "" ]).draw() if (!email_series_data[result.status]) { email_series_data[result.status] = 1 @@ -539,7 +539,7 @@ function load() { meta: status, value: count }) - $("#email_chart_legend").append('
  • ' + status + '
  • ') + $("#email_chart_legend").append('
  • ' + T(status) + '
  • ') }) var timeline_chart = new Chartist.Line('#timeline_chart', timeline_data, timeline_opts) timeline_chart.on('draw', function(data) { @@ -567,7 +567,7 @@ function load() { cidx = $point.attr('meta') html = "Event: " + campaign.timeline[cidx].message if (campaign.timeline[cidx].email) { - html += '
    ' + "Email: " + escapeHtml(campaign.timeline[cidx].email) + html += '
    ' + T("Email:") + " " + escapeHtml(campaign.timeline[cidx].email) } $toolTip.html(html).show() }); @@ -671,7 +671,7 @@ function load() { }) .error(function() { $("#loading").hide() - errorFlash(" Campaign not found!") + errorFlash(T("Campaign not found!")) }) } $(document).ready(function() { diff --git a/static/js/src/app/campaigns.js b/static/js/src/app/campaigns.js index 78155021..d9c8b3e6 100644 --- a/static/js/src/app/campaigns.js +++ b/static/js/src/app/campaigns.js @@ -14,12 +14,12 @@ var campaign = {} // Launch attempts to POST to /campaigns/ function launch() { swal({ - title: "Are you sure?", - text: "This will schedule the campaign to be launched.", + title: T("Are you sure?"), + text: T("This will schedule the campaign to be launched."), type: "question", animation: false, showCancelButton: true, - confirmButtonText: "Launch", + confirmButtonText: T("Launch"), confirmButtonColor: "#428bca", reverseButtons: true, allowOutsideClick: false, @@ -61,8 +61,8 @@ function launch() { } }).then(function() { swal( - 'Campaign Scheduled!', - 'This campaign has been scheduled for launch!', + T('Campaign Scheduled!'), + T('This campaign has been scheduled for launch!'), 'success' ); $('button:contains("OK")').on('click', function() { @@ -90,12 +90,12 @@ function sendTestEmail() { } } btnHtml = $("#sendTestModalSubmit").html() - $("#sendTestModalSubmit").html(' Sending') + $("#sendTestModalSubmit").html(' '+ T('Sending')) // Send the test email api.send_test_email(test_email_request) .success(function(data) { $("#sendTestEmailModal\\.flashes").empty().append("
    \ - Email Sent!
    ") + " + T('Email Sent!') + "") $("#sendTestModalSubmit").html(btnHtml) }) .error(function(data) { @@ -118,12 +118,12 @@ function dismiss() { function deleteCampaign(idx) { swal({ - title: "Are you sure?", - text: "This will delete the campaign. This can't be undone!", + title: T("Are you sure?"), + text: T("This will delete the campaign. This can't be undone!"), type: "warning", animation: false, showCancelButton: true, - confirmButtonText: "Delete " + campaigns[idx].name, + confirmButtonText: T("Delete") + " " + campaigns[idx].name, confirmButtonColor: "#428bca", reverseButtons: true, allowOutsideClick: false, @@ -140,8 +140,8 @@ function deleteCampaign(idx) { } }).then(function() { swal( - 'Campaign Deleted!', - 'This campaign has been deleted!', + T('Campaign Deleted!'), + T('This campaign has been deleted!'), 'success' ); $('button:contains("OK")').on('click', function() { @@ -154,7 +154,7 @@ function setupOptions() { api.groups.get() .success(function(groups) { if (groups.length == 0) { - modalError("No groups found!") + modalError(T("No groups found!")) return false; } else { var group_s2 = $.map(groups, function(obj) { @@ -162,7 +162,7 @@ function setupOptions() { return obj }); $("#users.form-control").select2({ - placeholder: "Select Groups", + placeholder: T("Select Groups"), data: group_s2, }); } @@ -170,7 +170,7 @@ function setupOptions() { api.templates.get() .success(function(templates) { if (templates.length == 0) { - modalError("No templates found!") + modalError(T("No templates found!")) return false } else { var template_s2 = $.map(templates, function(obj) { @@ -178,7 +178,7 @@ function setupOptions() { return obj }); $("#template.form-control").select2({ - placeholder: "Select a Template", + placeholder: T("Select a Template"), data: template_s2, }); } @@ -186,7 +186,7 @@ function setupOptions() { api.pages.get() .success(function(pages) { if (pages.length == 0) { - modalError("No pages found!") + modalError(T("No pages found!")) return false } else { var page_s2 = $.map(pages, function(obj) { @@ -194,7 +194,7 @@ function setupOptions() { return obj }); $("#page.form-control").select2({ - placeholder: "Select a Landing Page", + placeholder: T("Select a Landing Page"), data: page_s2, }); } @@ -202,7 +202,7 @@ function setupOptions() { api.SMTP.get() .success(function(profiles) { if (profiles.length == 0) { - modalError("No profiles found!") + modalError(T("No profiles found!")) return false } else { var profile_s2 = $.map(profiles, function(obj) { @@ -210,7 +210,7 @@ function setupOptions() { return obj }); $("#profile.form-control").select2({ - placeholder: "Select a Sending Profile", + placeholder: T("Select a Sending Profile"), data: profile_s2, }); } @@ -226,7 +226,7 @@ function copy(idx) { // Set our initial values api.campaignId.get(campaigns[idx].id) .success(function(campaign) { - $("#name").val("Copy of " + campaign.name) + $("#name").val(T("Copy of") + " " + campaign.name) if (!campaign.template.id) { $("#template").select2({ placeholder: campaign.template.name @@ -314,14 +314,14 @@ $(document).ready(function() { campaignTable.row.add([ escapeHtml(campaign.name), moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a'), - "" + campaign.status + "", - "
    \ + "" + T(campaign.status) + "", + "
    \ \ \ - \ -
    " ]).draw() @@ -333,7 +333,7 @@ $(document).ready(function() { }) .error(function() { $("#loading").hide() - errorFlash("Error fetching campaigns") + errorFlash(T("Error fetching campaigns")) }) // Select2 Defaults $.fn.select2.defaults.set("width", "100%"); diff --git a/static/js/src/app/dashboard.js b/static/js/src/app/dashboard.js index cb740543..7aa0709b 100644 --- a/static/js/src/app/dashboard.js +++ b/static/js/src/app/dashboard.js @@ -10,7 +10,7 @@ var labels = { } function deleteCampaign(idx) { - if (confirm(T("Delete ") + campaigns[idx].name + "?")) { + if (confirm(T("Delete") + " " + campaigns[idx].name + "?")) { api.campaignId.delete(campaigns[idx].id) .success(function(data) { successFlash(data.message) @@ -90,11 +90,11 @@ $(document).ready(function() { }) average = Math.floor(average / data.total); average_data.series.push({ - meta: "Unsuccessful Phishes", + meta: T("Unsuccessful Phishes"), value: 100 - average }) average_data.series.push({ - meta: "Successful Phishes", + meta: T("Successful Phishes"), value: average }) // Build the charts @@ -135,7 +135,7 @@ $(document).ready(function() { var $point = $(this) value = $point.attr('ct:value') || 0 cidx = $point.attr('ct:meta') - $toolTip.html(campaigns[cidx].name + '
    ' + "Successes: " + value.toString() + "%").show(); + $toolTip.html(campaigns[cidx].name + '
    ' + T("Successes:" + " " + value.toString() + "%").show(); }); $chart.on('mouseleave', '.ct-point', function() { @@ -156,6 +156,6 @@ $(document).ready(function() { } }) .error(function() { - errorFlash("Error fetching campaigns") + errorFlash(T("Error fetching campaigns")) }) }) diff --git a/static/js/src/app/landing_pages.js b/static/js/src/app/landing_pages.js index 60fb0f81..55888d79 100644 --- a/static/js/src/app/landing_pages.js +++ b/static/js/src/app/landing_pages.js @@ -18,7 +18,7 @@ function save(idx) { page.id = pages[idx].id api.pageId.put(page) .success(function(data) { - successFlash("Page edited successfully!") + successFlash(T("Page edited successfully!")) load() dismiss() }) @@ -26,7 +26,7 @@ function save(idx) { // Submit the page api.pages.post(page) .success(function(data) { - successFlash("Page added successfully!") + successFlash(T("Page added successfully!")) load() dismiss() }) @@ -49,7 +49,7 @@ function dismiss() { } function deletePage(idx) { - if (confirm("Delete " + pages[idx].name + "?")) { + if (confirm(T("Delete") + " " + pages[idx].name + "?")) { api.pageId.delete(pages[idx].id) .success(function(data) { successFlash(data.message) @@ -61,7 +61,7 @@ function deletePage(idx) { function importSite() { url = $("#url").val() if (!url) { - modalError("No URL Specified!") + modalError(T("No URL Specified!")) } else { api.clone_site({ url: url, @@ -104,7 +104,7 @@ function copy(idx) { }) $("#html_editor").ckeditor() var page = pages[idx] - $("#name").val("Copy of " + page.name) + $("#name").val(T("Copy of") + " " + page.name) $("#html_editor").val(page.html) } @@ -133,13 +133,13 @@ function load() { pagesTable.row.add([ escapeHtml(page.name), moment(page.modified_date).format('MMMM Do YYYY, h:mm:ss a'), - "
    \ - \ -
    " ]).draw() @@ -151,7 +151,7 @@ function load() { }) .error(function() { $("#loading").hide() - errorFlash("Error fetching pages") + errorFlash(T("Error fetching pages")) }) } diff --git a/static/js/src/app/sending_profiles.js b/static/js/src/app/sending_profiles.js index 1fbc23db..f80cd42d 100644 --- a/static/js/src/app/sending_profiles.js +++ b/static/js/src/app/sending_profiles.js @@ -18,12 +18,12 @@ function sendTestEmail() { } } btnHtml = $("#sendTestModalSubmit").html() - $("#sendTestModalSubmit").html(' Sending') + $("#sendTestModalSubmit").html(' ' + T('Sending')) // Send the test email api.send_test_email(test_email_request) .success(function(data) { $("#sendTestEmailModal\\.flashes").empty().append("
    \ - Email Sent!
    ") + " + T("Email Sent!") + "
    ") $("#sendTestModalSubmit").html(btnHtml) }) .error(function(data) { @@ -47,7 +47,7 @@ function save(idx) { profile.id = profiles[idx].id api.SMTPId.put(profile) .success(function(data) { - successFlash("Profile edited successfully!") + successFlash(T("Profile edited successfully!")) load() dismiss() }) @@ -58,7 +58,7 @@ function save(idx) { // Submit the profile api.SMTP.post(profile) .success(function(data) { - successFlash("Profile added successfully!") + successFlash(T("Profile added successfully!")) load() dismiss() }) @@ -81,7 +81,7 @@ function dismiss() { } function deleteProfile(idx) { - if (confirm("Delete " + profiles[idx].name + "?")) { + if (confirm(T("Delete") + " " + profiles[idx].name + "?")) { api.SMTPId.delete(profiles[idx].id) .success(function(data) { successFlash(data.message) @@ -113,7 +113,7 @@ function copy(idx) { }) var profile = {} profile = profiles[idx] - $("#name").val("Copy of " + profile.name) + $("#name").val(T("Copy of") + " " + profile.name) $("#interface_type").val(profile.interface_type) $("#from").val(profile.from_address) $("#host").val(profile.host) @@ -145,13 +145,13 @@ function load() { escapeHtml(profile.name), profile.interface_type, moment(profile.modified_date).format('MMMM Do YYYY, h:mm:ss a'), - "
    \ - \ -
    " ]).draw() @@ -163,7 +163,7 @@ function load() { }) .error(function() { $("#loading").hide() - errorFlash("Error fetching profiles") + errorFlash(T("Error fetching profiles")) }) } diff --git a/static/js/src/app/templates.js b/static/js/src/app/templates.js index 5c4e1255..3c24f72a 100644 --- a/static/js/src/app/templates.js +++ b/static/js/src/app/templates.js @@ -46,7 +46,7 @@ function save(idx) { template.id = templates[idx].id api.templateId.put(template) .success(function(data) { - successFlash("Template edited successfully!") + successFlash(T("Template edited successfully!")) load() dismiss() }) @@ -57,7 +57,7 @@ function save(idx) { // Submit the template api.templates.post(template) .success(function(data) { - successFlash("Template added successfully!") + successFlash(T("Template added successfully!")) load() dismiss() }) @@ -78,7 +78,7 @@ function dismiss() { } function deleteTemplate(idx) { - if (confirm("Delete " + templates[idx].name + "?")) { + if (confirm(T("Delete") + " " + templates[idx].name + "?")) { api.templateId.delete(templates[idx].id) .success(function(data) { successFlash(data.message) @@ -204,7 +204,7 @@ function copy(idx) { attachments: [] } template = templates[idx] - $("#name").val("Copy of " + template.name) + $("#name").val(T("Copy of") + " " + template.name) $("#subject").val(template.subject) $("#html_editor").val(template.html) $("#text_editor").val(template.text) @@ -236,7 +236,7 @@ function importEmail() { raw = $("#email_content").val() convert_links = $("#convert_links_checkbox").prop("checked") if (!raw) { - modalError("No Content Specified!") + modalError(T("No Content Specified!")) } else { $.ajax({ method: "POST", @@ -282,13 +282,13 @@ function load() { templateTable.row.add([ escapeHtml(template.name), moment(template.modified_date).format('MMMM Do YYYY, h:mm:ss a'), - "
    \ - \ -
    " ]).draw() @@ -300,7 +300,7 @@ function load() { }) .error(function() { $("#loading").hide() - errorFlash("Error fetching templates") + errorFlash(T("Error fetching templates")) }) } diff --git a/static/js/src/app/users.js b/static/js/src/app/users.js index a1defa2d..9f4a26af 100644 --- a/static/js/src/app/users.js +++ b/static/js/src/app/users.js @@ -22,7 +22,7 @@ function save(id) { group.id = id api.groupId.put(group) .success(function(data) { - successFlash("Group updated successfully!") + successFlash(T("Group updated successfully!")) load() dismiss() $("#modal").modal('hide') @@ -35,7 +35,7 @@ function save(id) { // to /groups api.groups.post(group) .success(function(data) { - successFlash("Group added successfully!") + successFlash(T("Group added successfully!")) load() dismiss() $("#modal").modal('hide') @@ -82,7 +82,7 @@ function edit(id) { }) .error(function() { - errorFlash("Error fetching group") + errorFlash(T("Error fetching group")) }) } // Handle file uploads @@ -93,7 +93,7 @@ function edit(id) { var acceptFileTypes = /(csv|txt)$/i; var filename = data.originalFiles[0]['name'] if (filename && !acceptFileTypes.test(filename.split(".").pop())) { - modalError("Unsupported file extension (use .csv or .txt)") + modalError(T("Unsupported file extension (use .csv or .txt)")) return false; } data.submit(); @@ -117,7 +117,7 @@ function deleteGroup(id) { console.log('wat'); return } - if (confirm("Delete " + group.name + "?")) { + if (confirm(T("Delete") + " " + group.name + "?")) { api.groupId.delete(id) .success(function(data) { successFlash(data.message) @@ -194,7 +194,7 @@ function load() { } }) .error(function() { - errorFlash("Error fetching groups") + errorFlash(T("Error fetching groups")) }) } diff --git a/templates/campaign_results.html b/templates/campaign_results.html index fd215914..5e5442dd 100644 --- a/templates/campaign_results.html +++ b/templates/campaign_results.html @@ -159,5 +159,5 @@ "Campaign not found!": "{{T "Campaign not found!"}}", } - + {{end}} diff --git a/templates/campaigns.html b/templates/campaigns.html index 1b6bc559..f4731455 100644 --- a/templates/campaigns.html +++ b/templates/campaigns.html @@ -175,5 +175,5 @@ "Error fetching campaigns": "{{T "Error fetching campaigns"}}" } - + {{end}} diff --git a/templates/dashboard.html b/templates/dashboard.html index b0d449d5..4416e72c 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -99,5 +99,5 @@ "Error fetching campaigns": "{{T "Error fetching campaigns"}}" } - + {{end}} diff --git a/templates/sending_profiles.html b/templates/sending_profiles.html index 45120dbc..f5c48690 100644 --- a/templates/sending_profiles.html +++ b/templates/sending_profiles.html @@ -149,5 +149,5 @@ - + {{end}} diff --git a/templates/templates.html b/templates/templates.html index 7014dea9..76a39b50 100644 --- a/templates/templates.html +++ b/templates/templates.html @@ -168,5 +168,5 @@ - + {{end}}
    ParameterValue(s)
    ' + T('Parameter') + '' + T('Value(s)') + '