mirror of https://github.com/gophish/gophish
feat(server): the endpoint complete campaigns is switched to the post method
parent
8e79294413
commit
f34d9405e2
|
@ -126,7 +126,7 @@ func (as *Server) CampaignComplete(w http.ResponseWriter, r *http.Request) {
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
id, _ := strconv.ParseInt(vars["id"], 0, 64)
|
id, _ := strconv.ParseInt(vars["id"], 0, 64)
|
||||||
switch {
|
switch {
|
||||||
case r.Method == "GET":
|
case r.Method == "POST" || r.Method == "GET":
|
||||||
err := models.CompleteCampaign(id, ctx.Get(r, "user_id").(int64))
|
err := models.CompleteCampaign(id, ctx.Get(r, "user_id").(int64))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
JSONResponse(w, models.Response{Success: false, Message: "Error completing campaign"}, http.StatusInternalServerError)
|
JSONResponse(w, models.Response{Success: false, Message: "Error completing campaign"}, http.StatusInternalServerError)
|
||||||
|
|
|
@ -102,7 +102,7 @@ var api = {
|
||||||
},
|
},
|
||||||
// complete() - Completes a campaign at POST /campaigns/:id/complete
|
// complete() - Completes a campaign at POST /campaigns/:id/complete
|
||||||
complete: function (id) {
|
complete: function (id) {
|
||||||
return query("/campaigns/" + id + "/complete", "GET", {}, true)
|
return query("/campaigns/" + id + "/complete", "POST", {}, true)
|
||||||
},
|
},
|
||||||
// summary() - Queries the API for GET /campaigns/summary
|
// summary() - Queries the API for GET /campaigns/summary
|
||||||
summary: function (id) {
|
summary: function (id) {
|
||||||
|
|
Loading…
Reference in New Issue