mirror of https://github.com/gophish/gophish
Changed status of new targets to "Sending" instead of "Unknown". Fixes #112
parent
c73a78bbdf
commit
ce8a9e5456
|
@ -226,14 +226,14 @@ func PostCampaign(c *Campaign, uid int64) error {
|
|||
for _, g := range c.Groups {
|
||||
// Insert a result for each target in the group
|
||||
for _, t := range g.Targets {
|
||||
r := Result{Email: t.Email, Status: STATUS_UNKNOWN, CampaignId: c.Id, UserId: c.UserId, FirstName: t.FirstName, LastName: t.LastName}
|
||||
r := &Result{Email: t.Email, Status: STATUS_SENDING, CampaignId: c.Id, UserId: c.UserId, FirstName: t.FirstName, LastName: t.LastName}
|
||||
r.GenerateId()
|
||||
err = db.Save(&r).Error
|
||||
err = db.Save(r).Error
|
||||
if err != nil {
|
||||
Logger.Printf("Error adding result record for target %s\n", t.Email)
|
||||
Logger.Println(err)
|
||||
}
|
||||
c.Results = append(c.Results, r)
|
||||
c.Results = append(c.Results, *r)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -34,6 +34,7 @@ const (
|
|||
EVENT_OPENED string = "Email Opened"
|
||||
EVENT_CLICKED string = "Clicked Link"
|
||||
STATUS_SUCCESS string = "Success"
|
||||
STATUS_SENDING string = "Sending"
|
||||
STATUS_UNKNOWN string = "Unknown"
|
||||
ERROR string = "Error"
|
||||
)
|
||||
|
|
|
@ -44,6 +44,12 @@ var statuses = {
|
|||
label: "label-default",
|
||||
icon: "fa-question"
|
||||
},
|
||||
"Sending": {
|
||||
slice: "ct-slice-donut-error",
|
||||
legend: "ct-legend-error",
|
||||
label: "label-primary",
|
||||
icon: "fa-spinner"
|
||||
},
|
||||
"Campaign Created": {
|
||||
label: "label-success",
|
||||
icon: "fa-rocket"
|
||||
|
|
|
@ -10,7 +10,7 @@ var labels = {
|
|||
|
||||
var campaigns = []
|
||||
|
||||
// Save attempts to POST to /campaigns/
|
||||
// Launch attempts to POST to /campaigns/
|
||||
function launch() {
|
||||
if (!confirm("This will launch the campaign. Are you sure?")) {
|
||||
return false;
|
||||
|
@ -22,31 +22,35 @@ function launch() {
|
|||
})
|
||||
})
|
||||
var campaign = {
|
||||
name: $("#name").val(),
|
||||
template: {
|
||||
name: $("#template").val()
|
||||
},
|
||||
url: $("#url").val(),
|
||||
page: {
|
||||
name: $("#page").val()
|
||||
},
|
||||
smtp: {
|
||||
from_address: $("input[name=from]").val(),
|
||||
host: $("input[name=host]").val(),
|
||||
username: $("input[name=username]").val(),
|
||||
password: $("input[name=password]").val(),
|
||||
},
|
||||
groups: groups
|
||||
}
|
||||
name: $("#name").val(),
|
||||
template: {
|
||||
name: $("#template").val()
|
||||
},
|
||||
url: $("#url").val(),
|
||||
page: {
|
||||
name: $("#page").val()
|
||||
},
|
||||
smtp: {
|
||||
from_address: $("input[name=from]").val(),
|
||||
host: $("input[name=host]").val(),
|
||||
username: $("input[name=username]").val(),
|
||||
password: $("input[name=password]").val(),
|
||||
},
|
||||
groups: groups
|
||||
}
|
||||
launchHtml = $("launchButton").html()
|
||||
$("launchButton").html('<i class="fa fa-spinner fa-spin"></i> Launching Campaign')
|
||||
// Submit the campaign
|
||||
api.campaigns.post(campaign)
|
||||
.success(function(data) {
|
||||
successFlash("Campaign successfully launched!")
|
||||
$("launchButton").html('<i class="fa fa-spinner fa-spin"></i> Redirecting')
|
||||
window.location = "/campaigns/" + data.id.toString()
|
||||
})
|
||||
.error(function(data) {
|
||||
$("#modal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-danger\">\
|
||||
<i class=\"fa fa-exclamation-circle\"></i> " + data.responseJSON.message + "</div>")
|
||||
$("#launchButton").html(launchHtml)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" onclick="launch()"><i class="fa fa-rocket"></i> Launch Campaign</button>
|
||||
<button type="button" id="launchButton" class="btn btn-primary" onclick="launch()"><i class="fa fa-rocket"></i> Launch Campaign</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue