From eb2f0e38c75d434117b9539d4894d432e204c46b Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Thu, 22 Mar 2018 21:29:07 -0500 Subject: [PATCH] Better handling of template errors when rendering the phishing page. Fixes #1008. --- controllers/phish.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/phish.go b/controllers/phish.go index 27fb2c40..4e8eed4f 100644 --- a/controllers/phish.go +++ b/controllers/phish.go @@ -114,6 +114,8 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) { p, err := models.GetPage(c.PageId, c.UserId) if err != nil { Logger.Println(err) + http.NotFound(w, r) + return } switch { case r.Method == "GET": @@ -143,6 +145,7 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) { if err != nil { Logger.Println(err) http.NotFound(w, r) + return } f, err := mail.ParseAddress(c.SMTP.FromAddress) if err != nil { @@ -171,6 +174,7 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) { if err != nil { Logger.Println(err) http.NotFound(w, r) + return } w.Write(htmlBuff.Bytes()) }