Compare commits

..

2 Commits

Author SHA1 Message Date
aecafc2986 Bumped to v0.2.13 2024-05-08 17:52:15 +02:00
a62d2287ae Added X-Session-ID cookie 2024-05-08 17:51:41 +02:00
2 changed files with 8 additions and 1 deletions

2
pkg.go
View File

@ -64,7 +64,7 @@ import (
"strings" "strings"
) )
const VERSION = "v0.2.12" const VERSION = "v0.2.13"
type HttpHandler func(http.ResponseWriter, *http.Request) type HttpHandler func(http.ResponseWriter, *http.Request)

View File

@ -75,6 +75,13 @@ func (service *Service) sessionNew(w http.ResponseWriter, r *http.Request, foo *
}, },
) )
cookie := http.Cookie{}
cookie.Name = "X-Session-ID"
cookie.Value = sess.UUID
cookie.MaxAge = 86400 * 365
cookie.Path = "/"
http.SetCookie(w, &cookie)
w.Write(respJSON) w.Write(respJSON)
} // }}} } // }}}
func (service *Service) sessionAuthenticate(w http.ResponseWriter, r *http.Request, sess *session.T) { // {{{ func (service *Service) sessionAuthenticate(w http.ResponseWriter, r *http.Request, sess *session.T) { // {{{