aboutsummaryrefslogtreecommitdiff
path: root/controllers/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'controllers/user.go')
-rw-r--r--controllers/user.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/controllers/user.go b/controllers/user.go
index a605c25..6685383 100644
--- a/controllers/user.go
+++ b/controllers/user.go
@@ -24,7 +24,13 @@ func (rt *Router) Login(w http.ResponseWriter, r *http.Request) {
}
sess := session.FromRequest(r)
- (*sess)["user"] = u
+ values := sess.Values(r.Context())
+ values["user"] = u
+
+ if err := sess.Save(w, r, values); err != nil {
+ mux.Render(w, r, mux.DefaultErrorHandler(err))
+ return
+ }
mux.Redirect(w, 302, "/")
return
@@ -34,7 +40,8 @@ func (rt *Router) Login(w http.ResponseWriter, r *http.Request) {
}
func (rt *Router) Logout(w http.ResponseWriter, r *http.Request) {
- session.Clear(w, r)
+ sess := session.FromRequest(r)
+ sess.Clear(w, r)
mux.Redirect(w, 302, "/")
}