mirror of https://github.com/gophish/gophish
Added ability to use template values in Landing Pages. Fixes #327
parent
e746a86816
commit
2eb2bf90a1
|
@ -1,6 +1,7 @@
|
||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
@ -208,7 +209,18 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
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
|
// Use allows us to stack middleware to process the request
|
||||||
|
|
Loading…
Reference in New Issue