diff --git a/controllers/api_test.go b/controllers/api_test.go
index 77a4b57e..31d5e627 100644
--- a/controllers/api_test.go
+++ b/controllers/api_test.go
@@ -102,6 +102,13 @@ func (s *ControllersSuite) SetupTest() {
c.UpdateStatus(models.CAMPAIGN_EMAILS_SENT)
}
+func (s *ControllersSuite) TestRequireAPIKey() {
+ resp, err := http.Post(fmt.Sprintf("%s/api/import/site", as.URL), "application/json", nil)
+ s.Nil(err)
+ defer resp.Body.Close()
+ s.Equal(resp.StatusCode, http.StatusBadRequest)
+}
+
func (s *ControllersSuite) TestSiteImportBaseHref() {
h := "
"
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
diff --git a/controllers/route.go b/controllers/route.go
index b7a3bd98..b3f59d4c 100644
--- a/controllers/route.go
+++ b/controllers/route.go
@@ -59,9 +59,9 @@ func CreateAdminRouter() http.Handler {
api.HandleFunc("/smtp/", Use(API_SMTP, mid.RequireAPIKey))
api.HandleFunc("/smtp/{id:[0-9]+}", Use(API_SMTP_Id, mid.RequireAPIKey))
api.HandleFunc("/util/send_test_email", Use(API_Send_Test_Email, mid.RequireAPIKey))
- api.HandleFunc("/import/group", API_Import_Group)
- api.HandleFunc("/import/email", API_Import_Email)
- api.HandleFunc("/import/site", API_Import_Site)
+ api.HandleFunc("/import/group", Use(API_Import_Group, mid.RequireAPIKey))
+ api.HandleFunc("/import/email", Use(API_Import_Email, mid.RequireAPIKey))
+ api.HandleFunc("/import/site", Use(API_Import_Site, mid.RequireAPIKey))
// Setup static file serving
router.PathPrefix("/").Handler(http.FileServer(http.Dir("./static/")))
diff --git a/static/js/dist/app/gophish.min.js b/static/js/dist/app/gophish.min.js
index 65dcd500..b1346d6c 100644
--- a/static/js/dist/app/gophish.min.js
+++ b/static/js/dist/app/gophish.min.js
@@ -1 +1 @@
-function errorFlash(e){$("#flashes").empty(),$("#flashes").append(' '+e+"
")}function successFlash(e){$("#flashes").empty(),$("#flashes").append(' '+e+"
")}function modalError(e){$("#modal\\.flashes").empty().append(' '+e+"
")}function query(e,t,n,r){return $.ajax({url:"/api"+e+"?api_key="+user.api_key,async:r,method:t,data:JSON.stringify(n),dataType:"json",contentType:"application/json"})}function escapeHtml(e){return $("").text(e).html()}function unescapeHtml(e){return $("").html(e).text()}var capitalize=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},api={campaigns:{get:function(){return query("/campaigns/","GET",{},!1)},post:function(e){return query("/campaigns/","POST",e,!1)},summary:function(){return query("/campaigns/summary","GET",{},!1)}},campaignId:{get:function(e){return query("/campaigns/"+e,"GET",{},!0)},delete:function(e){return query("/campaigns/"+e,"DELETE",{},!1)},results:function(e){return query("/campaigns/"+e+"/results","GET",{},!0)},complete:function(e){return query("/campaigns/"+e+"/complete","GET",{},!0)},summary:function(e){return query("/campaigns/"+e+"/summary","GET",{},!0)}},groups:{get:function(){return query("/groups/","GET",{},!1)},post:function(e){return query("/groups/","POST",e,!1)},summary:function(){return query("/groups/summary","GET",{},!0)}},groupId:{get:function(e){return query("/groups/"+e,"GET",{},!1)},put:function(e){return query("/groups/"+e.id,"PUT",e,!1)},delete:function(e){return query("/groups/"+e,"DELETE",{},!1)}},templates:{get:function(){return query("/templates/","GET",{},!1)},post:function(e){return query("/templates/","POST",e,!1)}},templateId:{get:function(e){return query("/templates/"+e,"GET",{},!1)},put:function(e){return query("/templates/"+e.id,"PUT",e,!1)},delete:function(e){return query("/templates/"+e,"DELETE",{},!1)}},pages:{get:function(){return query("/pages/","GET",{},!1)},post:function(e){return query("/pages/","POST",e,!1)}},pageId:{get:function(e){return query("/pages/"+e,"GET",{},!1)},put:function(e){return query("/pages/"+e.id,"PUT",e,!1)},delete:function(e){return query("/pages/"+e,"DELETE",{},!1)}},SMTP:{get:function(){return query("/smtp/","GET",{},!1)},post:function(e){return query("/smtp/","POST",e,!1)}},SMTPId:{get:function(e){return query("/smtp/"+e,"GET",{},!1)},put:function(e){return query("/smtp/"+e.id,"PUT",e,!1)},delete:function(e){return query("/smtp/"+e,"DELETE",{},!1)}},import_email:function(e){return query("/import/email","POST",{},!1)},clone_site:function(e){return query("/import/site","POST",e,!1)},send_test_email:function(e){return query("/util/send_test_email","POST",e,!0)}};$(document).ready(function(){$.fn.dataTable.moment("MMMM Do YYYY, h:mm:ss a"),$('[data-toggle="tooltip"]').tooltip()});
\ No newline at end of file
+function errorFlash(e){$("#flashes").empty(),$("#flashes").append(' '+e+"
")}function successFlash(e){$("#flashes").empty(),$("#flashes").append(' '+e+"
")}function modalError(e){$("#modal\\.flashes").empty().append(' '+e+"
")}function query(e,t,n,r){return $.ajax({url:"/api"+e+"?api_key="+user.api_key,async:r,method:t,data:JSON.stringify(n),dataType:"json",contentType:"application/json"})}function escapeHtml(e){return $("").text(e).html()}function unescapeHtml(e){return $("").html(e).text()}var capitalize=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},api={campaigns:{get:function(){return query("/campaigns/","GET",{},!1)},post:function(e){return query("/campaigns/","POST",e,!1)},summary:function(){return query("/campaigns/summary","GET",{},!1)}},campaignId:{get:function(e){return query("/campaigns/"+e,"GET",{},!0)},delete:function(e){return query("/campaigns/"+e,"DELETE",{},!1)},results:function(e){return query("/campaigns/"+e+"/results","GET",{},!0)},complete:function(e){return query("/campaigns/"+e+"/complete","GET",{},!0)},summary:function(e){return query("/campaigns/"+e+"/summary","GET",{},!0)}},groups:{get:function(){return query("/groups/","GET",{},!1)},post:function(e){return query("/groups/","POST",e,!1)},summary:function(){return query("/groups/summary","GET",{},!0)}},groupId:{get:function(e){return query("/groups/"+e,"GET",{},!1)},put:function(e){return query("/groups/"+e.id,"PUT",e,!1)},delete:function(e){return query("/groups/"+e,"DELETE",{},!1)}},templates:{get:function(){return query("/templates/","GET",{},!1)},post:function(e){return query("/templates/","POST",e,!1)}},templateId:{get:function(e){return query("/templates/"+e,"GET",{},!1)},put:function(e){return query("/templates/"+e.id,"PUT",e,!1)},delete:function(e){return query("/templates/"+e,"DELETE",{},!1)}},pages:{get:function(){return query("/pages/","GET",{},!1)},post:function(e){return query("/pages/","POST",e,!1)}},pageId:{get:function(e){return query("/pages/"+e,"GET",{},!1)},put:function(e){return query("/pages/"+e.id,"PUT",e,!1)},delete:function(e){return query("/pages/"+e,"DELETE",{},!1)}},SMTP:{get:function(){return query("/smtp/","GET",{},!1)},post:function(e){return query("/smtp/","POST",e,!1)}},SMTPId:{get:function(e){return query("/smtp/"+e,"GET",{},!1)},put:function(e){return query("/smtp/"+e.id,"PUT",e,!1)},delete:function(e){return query("/smtp/"+e,"DELETE",{},!1)}},import_email:function(e){return query("/import/email","POST",e,!1)},clone_site:function(e){return query("/import/site","POST",e,!1)},send_test_email:function(e){return query("/util/send_test_email","POST",e,!0)}};$(document).ready(function(){$.fn.dataTable.moment("MMMM Do YYYY, h:mm:ss a"),$('[data-toggle="tooltip"]').tooltip()});
\ No newline at end of file
diff --git a/static/js/dist/app/templates.min.js b/static/js/dist/app/templates.min.js
index 1d38c98a..fbd104da 100644
--- a/static/js/dist/app/templates.min.js
+++ b/static/js/dist/app/templates.min.js
@@ -1 +1 @@
-function save(a){var t={attachments:[]};t.name=$("#name").val(),t.subject=$("#subject").val(),t.html=CKEDITOR.instances.html_editor.getData(),t.html=t.html.replace(/https?:\/\/{{\.URL}}/gi,"{{.URL}}"),$("#use_tracker_checkbox").prop("checked")?t.html.indexOf("{{.Tracker}}")==-1&&t.html.indexOf("{{.TrackingUrl}}")==-1&&(t.html=t.html.replace("