From 7740bb3e95c58fc6795e32684a0d4321759276d0 Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Thu, 15 Sep 2016 00:27:10 -0500 Subject: [PATCH] Added ability to use {{.URL}} and {{.From}} in landing pages --- controllers/route.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/controllers/route.go b/controllers/route.go index 73360a26..233d6f74 100644 --- a/controllers/route.go +++ b/controllers/route.go @@ -8,6 +8,7 @@ import ( "log" "net" "net/http" + "net/mail" "net/url" "os" "strings" @@ -222,7 +223,24 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) { Logger.Println(err) http.NotFound(w, r) } - err = tmpl.Execute(&htmlBuff, rs) + f, err := mail.ParseAddress(c.SMTP.FromAddress) + if err != nil { + Logger.Println(err) + } + fn := f.Name + if fn == "" { + fn = f.Address + } + rsf := struct { + models.Result + URL string + From string + }{ + rs, + c.URL + "?rid=" + rs.RId, + fn, + } + err = tmpl.Execute(&htmlBuff, rsf) if err != nil { Logger.Println(err) http.NotFound(w, r)