Skip to content

Commit

Permalink
do not accept unauthenticated users to replays
Browse files Browse the repository at this point in the history
  • Loading branch information
mytja committed Nov 17, 2023
1 parent cbb3514 commit d444f83
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ func run(config *consts.ServerConfig) {
})
mux.HandleFunc(pat.Get("/replay/:game_id"), func(w http.ResponseWriter, r *http.Request) {
user, err := db.CheckToken(r)
if err != nil {
w.WriteHeader(http.StatusForbidden)
return
}

gameId := pat.Param(r, "game_id")
game, err := db.GetGame(gameId)
Expand Down

0 comments on commit d444f83

Please sign in to comment.