Better handling of template errors when rendering the phishing page. Fixes #1008.

pull/986/head^2
Jordan Wright 2018-03-22 21:29:07 -05:00
parent f21536da7c
commit eb2f0e38c7
No known key found for this signature in database
GPG Key ID: 138D5AD2331B3C11
1 changed files with 4 additions and 0 deletions

View File

@ -114,6 +114,8 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) {
p, err := models.GetPage(c.PageId, c.UserId) p, err := models.GetPage(c.PageId, c.UserId)
if err != nil { if err != nil {
Logger.Println(err) Logger.Println(err)
http.NotFound(w, r)
return
} }
switch { switch {
case r.Method == "GET": case r.Method == "GET":
@ -143,6 +145,7 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
Logger.Println(err) Logger.Println(err)
http.NotFound(w, r) http.NotFound(w, r)
return
} }
f, err := mail.ParseAddress(c.SMTP.FromAddress) f, err := mail.ParseAddress(c.SMTP.FromAddress)
if err != nil { if err != nil {
@ -171,6 +174,7 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
Logger.Println(err) Logger.Println(err)
http.NotFound(w, r) http.NotFound(w, r)
return
} }
w.Write(htmlBuff.Bytes()) w.Write(htmlBuff.Bytes())
} }