From f34d9405e2521c510164710f37eeab91e06c2228 Mon Sep 17 00:00:00 2001 From: Andrus Diaz German Date: Mon, 23 Sep 2024 19:36:42 -0400 Subject: [PATCH] feat(server): the endpoint complete campaigns is switched to the post method --- controllers/api/campaign.go | 2 +- static/js/src/app/gophish.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/api/campaign.go b/controllers/api/campaign.go index 33c08fe7..65106b19 100644 --- a/controllers/api/campaign.go +++ b/controllers/api/campaign.go @@ -126,7 +126,7 @@ func (as *Server) CampaignComplete(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) id, _ := strconv.ParseInt(vars["id"], 0, 64) switch { - case r.Method == "GET": + case r.Method == "POST" || r.Method == "GET": err := models.CompleteCampaign(id, ctx.Get(r, "user_id").(int64)) if err != nil { JSONResponse(w, models.Response{Success: false, Message: "Error completing campaign"}, http.StatusInternalServerError) diff --git a/static/js/src/app/gophish.js b/static/js/src/app/gophish.js index cb17d1da..88df2cb6 100644 --- a/static/js/src/app/gophish.js +++ b/static/js/src/app/gophish.js @@ -102,7 +102,7 @@ var api = { }, // complete() - Completes a campaign at POST /campaigns/:id/complete 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: function (id) {