From d87901b1227d327e8ec3a0940833b1b8bd8b203b Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 1 May 2015 08:20:02 -0700 Subject: [PATCH] minor login work --- main.go | 3 +-- route_handlers.go | 2 +- templates/layout.html | 8 ++------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index 0731c8b..029a26c 100644 --- a/main.go +++ b/main.go @@ -53,7 +53,6 @@ func loadConfig() { func dbConnect() { var err error - fmt.Println(fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=require", config.Sql.Username, config.Sql.Password, config.Sql.Host, config.Sql.Dbname)) db, err = sql.Open("postgres", fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=require", config.Sql.Username, config.Sql.Password, config.Sql.Host, config.Sql.Dbname)) if err != nil { @@ -90,7 +89,7 @@ func main() { initTemplates() init_route_handlers() - fmt.Println("Running...") + fmt.Println("Listening on", config.Port, "...") err := http.ListenAndServe(":"+config.Port, nil) if err != nil { fmt.Println("Fatal Error: ", err) diff --git a/route_handlers.go b/route_handlers.go index 9996534..3667843 100644 --- a/route_handlers.go +++ b/route_handlers.go @@ -34,7 +34,7 @@ func userHandler(next func(http.ResponseWriter, *http.Request, *user.User)) func return func(w http.ResponseWriter, r *http.Request) { user, _ := initSessionUser(r) if user == nil { - http.Redirect(w, r, "/", http.StatusFound) + http.Redirect(w, r, "/login", http.StatusFound) } else { next(w, r, user) } diff --git a/templates/layout.html b/templates/layout.html index 5c6f046..7d8087e 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -26,20 +26,16 @@ - MasterTracker + transmet