kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Fix #798: Allow users with dots in their usernames to request a subsonic password
rodzic
71b7f416cc
commit
b23e87e102
|
@ -28,6 +28,7 @@ class UserViewSet(mixins.UpdateModelMixin, viewsets.GenericViewSet):
|
||||||
queryset = models.User.objects.all()
|
queryset = models.User.objects.all()
|
||||||
serializer_class = serializers.UserWriteSerializer
|
serializer_class = serializers.UserWriteSerializer
|
||||||
lookup_field = "username"
|
lookup_field = "username"
|
||||||
|
lookup_value_regex = r"[a-zA-Z0-9-_.]+"
|
||||||
required_scope = "profile"
|
required_scope = "profile"
|
||||||
|
|
||||||
@action(methods=["get"], detail=False)
|
@action(methods=["get"], detail=False)
|
||||||
|
|
|
@ -225,6 +225,21 @@ def test_user_can_get_subsonic_token(logged_in_api_client):
|
||||||
assert response.data == {"subsonic_api_token": "test"}
|
assert response.data == {"subsonic_api_token": "test"}
|
||||||
|
|
||||||
|
|
||||||
|
def test_user_can_request_new_subsonic_token_uncommon_username(logged_in_api_client):
|
||||||
|
user = logged_in_api_client.user
|
||||||
|
user.username = "firstname.lastname"
|
||||||
|
user.subsonic_api_token = "test"
|
||||||
|
user.save()
|
||||||
|
|
||||||
|
url = reverse(
|
||||||
|
"api:v1:users:users-subsonic-token", kwargs={"username": user.username}
|
||||||
|
)
|
||||||
|
|
||||||
|
response = logged_in_api_client.post(url)
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
def test_user_can_delete_subsonic_token(logged_in_api_client):
|
def test_user_can_delete_subsonic_token(logged_in_api_client):
|
||||||
user = logged_in_api_client.user
|
user = logged_in_api_client.user
|
||||||
user.subsonic_api_token = "test"
|
user.subsonic_api_token = "test"
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Allow users with dots in their usernames to request a subsonic password (#798)
|
Ładowanie…
Reference in New Issue