fix(api): Use correct data field for rate limiting identity field
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2653>
This commit is contained in:
parent
0c2f9c8dbb
commit
150a9f68a4
5 changed files with 6 additions and 5 deletions
|
|
@ -349,7 +349,7 @@ class ScopesSerializer(serializers.Serializer):
|
|||
|
||||
class IdentSerializer(serializers.Serializer):
|
||||
type = serializers.CharField()
|
||||
id = serializers.IntegerField()
|
||||
id = serializers.CharField()
|
||||
|
||||
|
||||
class RateLimitSerializer(serializers.Serializer):
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from rest_framework import throttling as rest_throttling
|
|||
|
||||
def get_ident(user, request):
|
||||
if user and user.is_authenticated:
|
||||
return {"type": "authenticated", "id": user.pk}
|
||||
return {"type": "authenticated", "id": f"{user.pk}"}
|
||||
ident = rest_throttling.BaseThrottle().get_ident(request)
|
||||
|
||||
return {"type": "anonymous", "id": ident}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue