Skip to content

Commit

Permalink
Fix allauth 0.55.0 breaking changes
Browse files Browse the repository at this point in the history
didn't read changelog 🚶‍♂️
  • Loading branch information
Dutchman97 committed Oct 15, 2023
1 parent 62eecda commit 486985e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions survey/views/api/user.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from allauth.socialaccount.providers import registry as auth_provider_registry
from dataclasses import dataclass, field
from typing import Optional
from django.http import HttpRequest, HttpResponse, JsonResponse
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.generic import View
Expand All @@ -14,8 +13,7 @@ def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
jsonEncoder = json_encoder_factory()

if not request.user or not request.user.is_authenticated:
auth_provider = auth_provider_registry.by_id('reddit', request)
auth_url = auth_provider.get_login_url(request)
auth_url = reverse('reddit_login') # Get allauth's Reddit provider login URL (allauth.socialaccount.providers.RedditProvider.get_login_url(..))
return JsonResponse(AnonymousUserViewModel(
authentication_url=auth_url,
), encoder=jsonEncoder, safe=False)
Expand Down
2 changes: 2 additions & 0 deletions surveysite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',

'allauth.account.middleware.AccountMiddleware',

'django.middleware.common.CommonMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'htmlmin.middleware.MarkRequestMiddleware',
Expand Down

0 comments on commit 486985e

Please sign in to comment.