]> code.octet-stream.net Git - broadcaster/blobdiff - server/main.go
Various UI improvements
[broadcaster] / server / main.go
index 105e8581c077474241d2a8e7cbdd65bac7e6dc86..9f6927e9e63850ef8550e02e6b5fb29082c5dec6 100644 (file)
@@ -413,7 +413,7 @@ func changePasswordPage(w http.ResponseWriter, r *http.Request, user User) {
                        data.ShowForm = false
                        cookie, err := r.Cookie("broadcast_session")
                        if err == nil {
                        data.ShowForm = false
                        cookie, err := r.Cookie("broadcast_session")
                        if err == nil {
-                               log.Println("clearing other sessions for username", user.Username, "token", cookie.Value)
+                               log.Println("Clearing other sessions for username", user.Username, "token", cookie.Value)
                                db.ClearOtherSessions(user.Username, cookie.Value)
                        }
                }
                                db.ClearOtherSessions(user.Username, cookie.Value)
                        }
                }
@@ -642,7 +642,6 @@ func filesPage(w http.ResponseWriter, _ *http.Request, user User) {
        data := FilesPageData{
                Files: files.Files(),
        }
        data := FilesPageData{
                Files: files.Files(),
        }
-       log.Println("file page data", data)
        tmpl := template.Must(template.ParseFS(content, "templates/files.html"))
        err := tmpl.Execute(w, data)
        if err != nil {
        tmpl := template.Must(template.ParseFS(content, "templates/files.html"))
        err := tmpl.Execute(w, data)
        if err != nil {
@@ -671,13 +670,17 @@ func uploadFile(w http.ResponseWriter, r *http.Request) {
                f, _ := os.Create(path)
                defer f.Close()
                io.Copy(f, file)
                f, _ := os.Create(path)
                defer f.Close()
                io.Copy(f, file)
-               log.Println("uploaded file to", path)
+               log.Println("Uploaded file to", path)
                files.Refresh()
        }
        http.Redirect(w, r, "/files/", http.StatusFound)
 }
 
 func logOutPage(w http.ResponseWriter, r *http.Request, user User) {
                files.Refresh()
        }
        http.Redirect(w, r, "/files/", http.StatusFound)
 }
 
 func logOutPage(w http.ResponseWriter, r *http.Request, user User) {
+       cookie, err := r.Cookie("broadcast_session")
+       if err == nil {
+               db.ClearSession(user.Username, cookie.Value)
+       }
        clearSessionCookie(w)
        renderHeader(w, "", user)
        tmpl := template.Must(template.ParseFS(content, "templates/logout.html"))
        clearSessionCookie(w)
        renderHeader(w, "", user)
        tmpl := template.Must(template.ParseFS(content, "templates/logout.html"))