From 0e496bdf739fba90b22188e77491eade327ba570 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 21 Jun 2015 16:10:47 -0500 Subject: [PATCH] Migrated settings (at least it loads). Working on making the template syntax consistent across all the files, cleaning them up, etc. --- controllers/route.go | 9 +++- templates/dashboard.html | 3 ++ templates/register.html | 6 +-- templates/settings.html | 110 ++++++++++++++++++++------------------- templates/templates.html | 35 ++++++++----- 5 files changed, 91 insertions(+), 72 deletions(-) diff --git a/controllers/route.go b/controllers/route.go index 9ce43590..ef67697c 100644 --- a/controllers/route.go +++ b/controllers/route.go @@ -182,7 +182,6 @@ func Register(w http.ResponseWriter, r *http.Request) { // Base handles the default path and template execution func Base(w http.ResponseWriter, r *http.Request) { - // Example of using session - will be removed. params := struct { User models.User Title string @@ -255,6 +254,14 @@ func LandingPages(w http.ResponseWriter, r *http.Request) { // Settings handles the changing of settings func Settings(w http.ResponseWriter, r *http.Request) { switch { + case r.Method == "GET": + params := struct { + User models.User + Title string + Flashes []interface{} + Token string + }{Title: "Dashboard", User: ctx.Get(r, "user").(models.User), Token: nosurf.Token(r)} + getTemplate(w, "settings").ExecuteTemplate(w, "base", params) case r.Method == "POST": err := auth.ChangePassword(r) msg := models.Response{Success: true, Message: "Settings Updated Successfully"} diff --git a/templates/dashboard.html b/templates/dashboard.html index 52758493..c2fea5b3 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -78,3 +78,6 @@ {{end}} +{{define "scripts"}} + +{{end}} diff --git a/templates/register.html b/templates/register.html index 940116db..1dfe10d4 100644 --- a/templates/register.html +++ b/templates/register.html @@ -8,7 +8,7 @@ - + Gophish - {{ .Title }} @@ -54,15 +54,13 @@ {{template "flashes" .Flashes}} - + - - diff --git a/templates/settings.html b/templates/settings.html index 6851eaa8..15dc595d 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -1,66 +1,70 @@ {{define "body"}} -
-
-

- Settings -

+ -
-