Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Rename django-allauth's URL prefix

Roland Geider518a21948078
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e68359103..6f3a8ba59 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -111,5 +111,5 @@ one, visit the "API key" page in the user settings and paste it into scripts.
**`/api/v2/token` endpoint removed.** Exchanging username + password for a JWT
pair via this endpoint bypassed 2FA. To get tokens, either use
-`/_allauth/app/v1/auth/login` (which respects the MFA challenge flow) or mint
+`/allauth/app/v1/auth/login` (which respects the MFA challenge flow) or mint
a long-lived refresh token from the "API key" page in the user settings.
diff --git a/wger/core/api/serializers.py b/wger/core/api/serializers.py
index dd747d295..8a831a473 100644
--- a/wger/core/api/serializers.py
+++ b/wger/core/api/serializers.py
@@ -38,8 +38,7 @@ class UserprofileSerializer(serializers.ModelSerializer):
Workout session serializer
"""
- # Email is read-only here; the app manages email changes through
- # allauth.headless (POST /_allauth/app/v1/account/email).
+ # Email is read-only here; the app manages email changes through allauth.headless
email = serializers.EmailField(source='user.email', read_only=True)
username = serializers.CharField(source='user.username', read_only=True)
date_joined = serializers.DateTimeField(source='user.date_joined', read_only=True)
diff --git a/wger/core/tests/api/test_issue_refresh_token.py b/wger/core/tests/api/test_issue_refresh_token.py
index ede4b0c54..108873352 100644
--- a/wger/core/tests/api/test_issue_refresh_token.py
+++ b/wger/core/tests/api/test_issue_refresh_token.py
@@ -16,6 +16,7 @@
# Django
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
+from django.urls import reverse
# Third Party
from rest_framework.authtoken.models import Token
@@ -58,7 +59,7 @@ class IssueRefreshTokenApiTestCase(WgerTestCase):
# exchange endpoint without us having to know its internal shape.
anon = APIClient()
exchange = anon.post(
- '/_allauth/app/v1/tokens/refresh',
+ reverse('headless:app:tokens:refresh'),
data={'refresh_token': refresh_token},
format='json',
)
diff --git a/wger/core/tests/test_headless.py b/wger/core/tests/test_headless.py
index 76b9b5bd6..e721bfebc 100644
--- a/wger/core/tests/test_headless.py
+++ b/wger/core/tests/test_headless.py
@@ -43,14 +43,14 @@ class HeadlessSmokeTestCase(WgerTestCase):
"""
def test_config_endpoint(self):
- response = self.client.get('/_allauth/app/v1/config')
+ response = self.client.get(reverse('headless:app:config'))
self.assertEqual(response.status_code, 200)
body = response.json()
self.assertEqual(body['status'], 200)
def test_login_mints_jwt_and_authenticates_drf(self):
response = self.client.post(
- '/_allauth/app/v1/auth/login',
+ reverse('headless:app:account:login'),
data=json.dumps({'username': 'test', 'password': 'testtest'}),
content_type='application/json',
)
@@ -91,7 +91,7 @@ class HeadlessSmokeTestCase(WgerTestCase):
):
count_before = User.objects.count()
response = self.client.post(
- '/_allauth/app/v1/auth/signup',
+ reverse('headless:app:account:signup'),
data=json.dumps(signup_data),
content_type='application/json',
)
@@ -102,7 +102,7 @@ class HeadlessSmokeTestCase(WgerTestCase):
# payload creates a user via the headless endpoint.
count_before = User.objects.count()
response = self.client.post(
- '/_allauth/app/v1/auth/signup',
+ reverse('headless:app:account:signup'),
data=json.dumps(signup_data),
content_type='application/json',
)
diff --git a/wger/urls.py b/wger/urls.py
index 4b1094d9a..1099c3dbd 100644
--- a/wger/urls.py
+++ b/wger/urls.py
@@ -303,7 +303,7 @@ urlpatterns += [
path('account/', include('allauth.urls')),
# REST auth API consumed by the Flutter app.
- path('_allauth/', include('allauth.headless.urls')),
+ path('allauth/', include('allauth.headless.urls')),
# API
path(
'api/v2/exercise-submission/',