audit items
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
package hub
|
package hub
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SESSION_ID_COOKIE_NAME = "SessionID"
|
sessionIDCookieName = "SessionID"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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) {
|
func (app *App) handlePub(pattern string, fn handlerFunc) {
|
||||||
wrapped := func(w http.ResponseWriter, r *http.Request) {
|
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)
|
s, err := app.api.Session_Get(sessionID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to get session: %v", err)
|
log.Printf("Failed to get session: %v", err)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func (a *App) _signinSubmit(s *api.Session, w http.ResponseWriter, r *http.Reque
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
a.setCookie(w, SESSION_ID_COOKIE_NAME, sess.SessionID)
|
a.setCookie(w, sessionIDCookieName, sess.SessionID)
|
||||||
|
|
||||||
return a.redirect(w, r, "/")
|
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 {
|
if err := a.api.Session_Delete(s.SessionID); err != nil {
|
||||||
log.Printf("Failed to delete session cookie %s: %v", s.SessionID, err)
|
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, "/")
|
return a.redirect(w, r, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user