diff --git a/main.go b/main.go index 34f456b..3b2f04b 100644 --- a/main.go +++ b/main.go @@ -37,6 +37,7 @@ func main() { //Login logout http.HandleFunc("/login/", views.LoginFunc) http.HandleFunc("/logout/", views.RequiresLogin(views.LogoutFunc)) + http.HandleFunc("/signup/", views.SignUpFunc) http.HandleFunc("/add-category/", views.RequiresLogin(views.AddCategoryFunc)) http.HandleFunc("/add-comment/", views.RequiresLogin(views.AddCommentFunc)) diff --git a/sessions/sessions.go b/sessions/sessions.go index be955c6..55c3960 100755 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -11,8 +11,8 @@ var Store = sessions.NewCookieStore([]byte("secret-password")) //IsLoggedIn will check if the user has an active session and return True func IsLoggedIn(r *http.Request) bool { - session, _ := Store.Get(r, "session") - if session.Values["loggedin"] == "true" { + session, err := Store.Get(r, "session") + if err == nil && (session.Values["loggedin"] == "true") { return true } return false diff --git a/templates/login.html b/templates/login.html index 47d3ae1..eeaf200 100644 --- a/templates/login.html +++ b/templates/login.html @@ -20,6 +20,7 @@