diff --git a/pages/base.html b/pages/base.html index c776ae1..4fa47f3 100644 --- a/pages/base.html +++ b/pages/base.html @@ -29,7 +29,7 @@ diff --git a/src/server/server.go b/src/server/server.go index f8bf6b9..b3cbb58 100644 --- a/src/server/server.go +++ b/src/server/server.go @@ -134,7 +134,12 @@ func New(config conf.Conf) (*Server, error) { return } - requestedPage.ExecuteTemplate(w, "index.html", &pageData) + err = requestedPage.ExecuteTemplate(w, "index.html", &pageData) + if err != nil { + http.Redirect(w, req, "/error", http.StatusTemporaryRedirect) + logger.Error("[Server][/category/] Template error: %s", err) + return + } } else if path.Dir(req.URL.Path) == "/group" { if req.Method != "GET" { http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) @@ -178,7 +183,12 @@ func New(config conf.Conf) (*Server, error) { return } - requestedPage.ExecuteTemplate(w, "category.html", &pageData) + err = requestedPage.ExecuteTemplate(w, "category.html", &pageData) + if err != nil { + http.Redirect(w, req, "/error", http.StatusTemporaryRedirect) + logger.Error("[Server][/category/] Template error: %s", err) + return + } } else { // default @@ -188,7 +198,12 @@ func New(config conf.Conf) (*Server, error) { req.URL.Path[1:]+".html", ) if err == nil { - requestedPage.ExecuteTemplate(w, req.URL.Path[1:]+".html", nil) + err = requestedPage.ExecuteTemplate(w, req.URL.Path[1:]+".html", nil) + if err != nil { + http.Redirect(w, req, "/error", http.StatusTemporaryRedirect) + logger.Error("[Server][/default] Template error: %s", err) + return + } } else { http.Redirect(w, req, "/error", http.StatusTemporaryRedirect) } diff --git a/src/server/validation.go b/src/server/validation.go index 5c79b9e..a201072 100644 --- a/src/server/validation.go +++ b/src/server/validation.go @@ -30,6 +30,7 @@ const ( MinimalPasswordLength uint = 5 MaxLoginLength uint = 60 MaxPasswordLength uint = 250 + MaxTodoLength uint = 150 ) // Check if user is valid. Returns false and a reason-string if not