Skip to content

Commit 56c1a7a

Browse files
committed
x
1 parent 0dfad0c commit 56c1a7a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

web/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,12 @@ func main() {
916916

917917
// Update username
918918
router.POST("/users/me/username", func(c *gin.Context) {
919-
userID, _ := c.Get("user_id")
919+
log.Printf("=== Username change endpoint hit ===")
920+
userID, exists := c.Get("user_id")
921+
log.Printf("user_id from context: %v, exists: %v", userID, exists)
922+
920923
if userID == nil {
924+
log.Printf("Unauthorized: user_id is nil")
921925
c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
922926
return
923927
}
@@ -926,6 +930,7 @@ func main() {
926930
NewUsername string `json:"new_username"`
927931
}
928932
if err := c.BindJSON(&req); err != nil {
933+
log.Printf("Failed to bind JSON: %v", err)
929934
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
930935
return
931936
}

0 commit comments

Comments
 (0)