From 2eb2bf90a1fc25c5ae9c695616a41414aff21728 Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Sun, 24 Jul 2016 19:37:14 -0500 Subject: [PATCH] Added ability to use template values in Landing Pages. Fixes #327 --- controllers/route.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/controllers/route.go b/controllers/route.go index 44accc9f..6a6fc6d6 100644 --- a/controllers/route.go +++ b/controllers/route.go @@ -1,6 +1,7 @@ package controllers import ( + "bytes" "encoding/json" "fmt" "html/template" @@ -208,7 +209,18 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) { return } } - w.Write([]byte(p.HTML)) + var htmlBuff bytes.Buffer + tmpl, err := template.New("html_template").Parse(p.HTML) + if err != nil { + Logger.Println(err) + http.NotFound(w, r) + } + err = tmpl.Execute(&htmlBuff, rs) + if err != nil { + Logger.Println(err) + http.NotFound(w, r) + } + w.Write(htmlBuff.Bytes()) } // Use allows us to stack middleware to process the request