forked from jason/cpolis
Bug fix
This commit is contained in:
@@ -70,7 +70,7 @@ func StartSessions() (map[string]*Session, chan string) {
|
||||
func ManageSession(w http.ResponseWriter, r *http.Request, c *b.Config, s map[string]*Session) (*Session, error) {
|
||||
tmpl, tmplErr := template.ParseFiles(c.WebDir+"/templates/index.html", c.WebDir+"/templates/login.html")
|
||||
|
||||
cookie, err := r.Cookie("session_id")
|
||||
cookie, err := r.Cookie("cpolis_session")
|
||||
if err != nil {
|
||||
if err = template.Must(tmpl, tmplErr).ExecuteTemplate(w, "page-content", nil); err != nil {
|
||||
return nil, fmt.Errorf("error executing template: %v", err)
|
||||
@@ -92,7 +92,7 @@ func ManageSession(w http.ResponseWriter, r *http.Request, c *b.Config, s map[st
|
||||
}
|
||||
|
||||
session.cookie.Expires = time.Now().Add(time.Hour * time.Duration(c.CookieExpiryHours))
|
||||
http.SetCookie(w, cookie)
|
||||
http.SetCookie(w, session.cookie)
|
||||
|
||||
return session, nil
|
||||
}
|
||||
@@ -138,7 +138,7 @@ func Logout(c *b.Config, s map[string]*Session) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
tmpl, tmplErr := template.ParseFiles(c.WebDir + "/templates/login.html")
|
||||
|
||||
cookie, err := r.Cookie("session_id")
|
||||
cookie, err := r.Cookie("cpolis_session")
|
||||
if err != nil {
|
||||
if err = template.Must(tmpl, tmplErr).ExecuteTemplate(w, "page-content", nil); err != nil {
|
||||
log.Println(err)
|
||||
|
Reference in New Issue
Block a user