How To Add Query Parameters To Django-allauth Login_redirect_url?
My JS file is embedded on a third party page the JS file talks to my server using a jsonp request which returns a value which gets stored inside variable x now i want to authentic
Solution 1:
You could change LOGIN_REDIRECT_URL
to something like /redirect
and this will in turn be an 'intermediary' view that controls where the user gets redirected to.
That view could look something like this (untested):
from django.views.generic import View
from django.http import HttpResponseRedirect
classLoginRedirectIntermediary(View):
"""
Decides where a newly logged in user should go based on the request.
"""defget(self, request, *args, **kwargs):
if request.user.is_superuser:
url = '/admin-panel/{}/'else:
url = '/user-panel/{}/'return HttpResponseRedirect(url.format(request.user.username))
Post a Comment for "How To Add Query Parameters To Django-allauth Login_redirect_url?"