|
|
@ -5,6 +5,7 @@ import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/pagefaultgames/pokerogue-server/api/account"
|
|
|
|
"github.com/pagefaultgames/pokerogue-server/api/daily"
|
|
|
|
"github.com/pagefaultgames/pokerogue-server/api/daily"
|
|
|
|
"github.com/pagefaultgames/pokerogue-server/db"
|
|
|
|
"github.com/pagefaultgames/pokerogue-server/db"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -24,8 +25,8 @@ func getUsernameFromRequest(r *http.Request) (string, error) {
|
|
|
|
return "", fmt.Errorf("failed to decode token: %s", err)
|
|
|
|
return "", fmt.Errorf("failed to decode token: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if len(token) != 32 {
|
|
|
|
if len(token) != account.TokenSize {
|
|
|
|
return "", fmt.Errorf("invalid token length: got %d, expected 32", len(token))
|
|
|
|
return "", fmt.Errorf("invalid token length: got %d, expected %d", len(token), account.TokenSize)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
username, err := db.FetchUsernameFromToken(token)
|
|
|
|
username, err := db.FetchUsernameFromToken(token)
|
|
|
@ -46,8 +47,8 @@ func getUUIDFromRequest(r *http.Request) ([]byte, error) {
|
|
|
|
return nil, fmt.Errorf("failed to decode token: %s", err)
|
|
|
|
return nil, fmt.Errorf("failed to decode token: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if len(token) != 32 {
|
|
|
|
if len(token) != account.TokenSize {
|
|
|
|
return nil, fmt.Errorf("invalid token length: got %d, expected 32", len(token))
|
|
|
|
return nil, fmt.Errorf("invalid token length: got %d, expected %d", len(token), account.TokenSize)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uuid, err := db.FetchUUIDFromToken(token)
|
|
|
|
uuid, err := db.FetchUUIDFromToken(token)
|
|
|
|