if not request_cookie is None redirect_url request GET get redirect_ur

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
if not request_cookie is None:
redirect_url = request.GET.get('redirect_url', None)
redirect_url = self.b64_url_decode(redirect_url)
response = HttpResponseRedirect('http://%s' % redirect_url)
session_key = request.session.session_key
domain = '.' + redirect_url.replace('http://', '').split('/')[0]
response.set_cookie(settings.SESSION_COOKIE_NAME,
session_key, max_age=None,
expires=None, domain=domain,
path=settings.SESSION_COOKIE_PATH,
secure=settings.SESSION_COOKIE_SECURE or None)
return HttpResponseRedirect(response)