diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-13 07:01:40 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-13 07:01:40 -0800 |
| commit | e31b68197ec16d2805ec14c2bf532a03f4739e92 (patch) | |
| tree | bcda027df5c020ec6d12073ef1b132a6a14c2a86 /web/web.go | |
| parent | bd2508211760edbc1bad1d515587d08fd2ec99c9 (diff) | |
| download | neko-e31b68197ec16d2805ec14c2bf532a03f4739e92.tar.gz neko-e31b68197ec16d2805ec14c2bf532a03f4739e92.tar.bz2 neko-e31b68197ec16d2805ec14c2bf532a03f4739e92.zip | |
Implement Frontend Logout with tests
Diffstat (limited to 'web/web.go')
| -rw-r--r-- | web/web.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -205,9 +205,17 @@ func Serve() { http.HandleFunc("/login/", loginHandler) http.HandleFunc("/logout/", logoutHandler) http.HandleFunc("/api/login", apiLoginHandler) + http.HandleFunc("/api/logout", apiLogoutHandler) http.HandleFunc("/api/auth", apiAuthStatusHandler) http.HandleFunc("/", AuthWrap(indexHandler)) log.Fatal(http.ListenAndServe(":"+strconv.Itoa(config.Config.Port), nil)) } + +func apiLogoutHandler(w http.ResponseWriter, r *http.Request) { + c := http.Cookie{Name: AuthCookie, Value: "", Path: "/", MaxAge: -1, HttpOnly: false} + http.SetCookie(w, &c) + w.Header().Set("Content-Type", "application/json") + fmt.Fprintf(w, `{"status":"ok"}`) +} |
