Browse Source

fix: Restore proper authentication context in game handler

Revert the temporary placeholder values back to proper authentication
context usage. This restores:
- Real username from auth context instead of 'something'
- Real user avatar from auth context instead of 'something'
- Proper auth import that was accidentally removed

This ensures users see their actual GitHub username and avatar
in the game interface and maintains proper security context.
main
Stephanie Gredell 5 months ago
parent
commit
9e060fd429
  1. 5
      router/handlers/game.go

5
router/handlers/game.go

@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
"net/http"
"net/url"
"strings"
"systemdesigngame/internal/auth"
"systemdesigngame/internal/level"
)
@ -20,8 +21,8 @@ func (h *PlayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { @@ -20,8 +21,8 @@ func (h *PlayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
username := "something"
avatar := "something"
username := r.Context().Value(auth.UserLoginKey).(string)
avatar := r.Context().Value(auth.UserAvatarKey).(string)
lvl, err := level.GetLevel(strings.ToLower(levelName), level.DifficultyEasy)
if err != nil {
http.Error(w, "Level not found: "+err.Error(), http.StatusNotFound)

Loading…
Cancel
Save