fix(api): Replace deprecated is_ajax with manual check

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2709>
environments/review-docs-v2-ov-8q6uyo/deployments/19325
Georg Krause 2024-02-06 10:59:39 +01:00 zatwierdzone przez Marge
rodzic 803b077f00
commit b4920af0b8
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -200,7 +200,7 @@ class AuthorizeView(views.APIView, oauth_views.AuthorizationView):
return self.json_payload({"non_field_errors": ["Invalid application"]}, 400)
def redirect(self, redirect_to, application):
if self.request.is_ajax():
if self.request.META.get("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest":
# Web client need this to be able to redirect the user
query = urllib.parse.urlparse(redirect_to).query
code = urllib.parse.parse_qs(query)["code"][0]