Added ability to use template values in Landing Pages. Fixes #327

pull/260/head
Jordan Wright 2016-07-24 19:37:14 -05:00
parent e746a86816
commit 2eb2bf90a1
1 changed files with 13 additions and 1 deletions

View File

@ -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