aboutsummaryrefslogtreecommitdiff
path: root/service/transport.go
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2020-03-04 15:59:59 +0000
committerr <r@freesoftwareextremist.com>2020-03-04 15:59:59 +0000
commit911c9b79937a82bd4574972fa24f45f5cb922092 (patch)
treec0f0ce04c6e0d0e2b8a7b552b8cb887ceb362ad5 /service/transport.go
parent35a8c247d910f4a17aea5dd9df511f6e44bbc4bf (diff)
downloadbloat-911c9b79937a82bd4574972fa24f45f5cb922092.tar.gz
bloat-911c9b79937a82bd4574972fa24f45f5cb922092.zip
Remove session details on signout
Diffstat (limited to 'service/transport.go')
-rw-r--r--service/transport.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/service/transport.go b/service/transport.go
index 48e2ee2..6540333 100644
--- a/service/transport.go
+++ b/service/transport.go
@@ -646,12 +646,16 @@ func NewHandler(s Service, staticDir string) http.Handler {
}
signout := func(w http.ResponseWriter, req *http.Request) {
- // TODO remove session from database
+ c := newClient(w)
+ ctx := newCtxWithSesionCSRF(req, req.FormValue("csrf_token"))
+
+ s.Signout(ctx, c)
http.SetCookie(w, &http.Cookie{
Name: "session_id",
Value: "",
Expires: time.Now(),
})
+
w.Header().Add("Location", "/")
w.WriteHeader(http.StatusFound)
}
@@ -763,7 +767,7 @@ func NewHandler(s Service, staticDir string) http.Handler {
r.HandleFunc("/unmuteconv/{id}", unMuteConversation).Methods(http.MethodPost)
r.HandleFunc("/delete/{id}", delete).Methods(http.MethodPost)
r.HandleFunc("/notifications/read", readNotifications).Methods(http.MethodPost)
- r.HandleFunc("/signout", signout).Methods(http.MethodGet)
+ r.HandleFunc("/signout", signout).Methods(http.MethodPost)
r.HandleFunc("/fluoride/like/{id}", fLike).Methods(http.MethodPost)
r.HandleFunc("/fluoride/unlike/{id}", fUnlike).Methods(http.MethodPost)
r.HandleFunc("/fluoride/retweet/{id}", fRetweet).Methods(http.MethodPost)