diff --git a/hub/global.go b/hub/global.go index 9f9a308..525b63a 100644 --- a/hub/global.go +++ b/hub/global.go @@ -1,5 +1,5 @@ package hub const ( - SESSION_ID_COOKIE_NAME = "SessionID" + sessionIDCookieName = "SessionID" ) diff --git a/hub/handler.go b/hub/handler.go index 7dedf05..13bfe50 100644 --- a/hub/handler.go +++ b/hub/handler.go @@ -12,7 +12,7 @@ type handlerFunc func(s *api.Session, w http.ResponseWriter, r *http.Request) er func (app *App) handlePub(pattern string, fn handlerFunc) { wrapped := func(w http.ResponseWriter, r *http.Request) { - sessionID := app.getCookie(r, SESSION_ID_COOKIE_NAME) + sessionID := app.getCookie(r, sessionIDCookieName) s, err := app.api.Session_Get(sessionID) if err != nil { log.Printf("Failed to get session: %v", err) diff --git a/hub/handlers.go b/hub/handlers.go index 7f90f80..bcbe82b 100644 --- a/hub/handlers.go +++ b/hub/handlers.go @@ -38,7 +38,7 @@ func (a *App) _signinSubmit(s *api.Session, w http.ResponseWriter, r *http.Reque if err != nil { return err } - a.setCookie(w, SESSION_ID_COOKIE_NAME, sess.SessionID) + a.setCookie(w, sessionIDCookieName, sess.SessionID) return a.redirect(w, r, "/") } @@ -51,7 +51,7 @@ func (a *App) _adminSignOutSubmit(s *api.Session, w http.ResponseWriter, r *http if err := a.api.Session_Delete(s.SessionID); err != nil { log.Printf("Failed to delete session cookie %s: %v", s.SessionID, err) } - a.deleteCookie(w, SESSION_ID_COOKIE_NAME) + a.deleteCookie(w, sessionIDCookieName) return a.redirect(w, r, "/") }