summaryrefslogtreecommitdiff
path: root/django/archives/auth.py
diff options
context:
space:
mode:
authorMagnus Hagander2020-04-14 15:57:58 +0000
committerMagnus Hagander2020-04-14 15:57:58 +0000
commitcc148739fdb9ad841ee02b261512e68cdff48baa (patch)
tree6bc1b780539ab267adfa545e565f2e65614b1cfd /django/archives/auth.py
parent3268abf0d1e2cfd88eafc3272d8e3b84a43769e2 (diff)
Extra quote the url from 'next' in authentication
If the next URL contained a + django would helpfully change that into a space, which broke things further down the chain. So put back this escaping, in the hope that the redirect will be correct down the road. This fixes is for spaces, let's hope it doesn't instead break it for something else.
Diffstat (limited to 'django/archives/auth.py')
-rw-r--r--django/archives/auth.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/archives/auth.py b/django/archives/auth.py
index 87ffb0b..069d57c 100644
--- a/django/archives/auth.py
+++ b/django/archives/auth.py
@@ -28,7 +28,7 @@ from django.conf import settings
import base64
import json
import socket
-from urllib.parse import urlparse, urlencode, parse_qs
+from urllib.parse import urlparse, urlencode, parse_qs, quote_plus
import requests
from Cryptodome.Cipher import AES
from Cryptodome.Hash import SHA
@@ -53,7 +53,7 @@ def login(request):
# Put together an url-encoded dict of parameters we're getting back,
# including a small nonce at the beginning to make sure it doesn't
# encrypt the same way every time.
- s = "t=%s&%s" % (int(time.time()), urlencode({'r': request.GET['next']}))
+ s = "t=%s&%s" % (int(time.time()), urlencode({'r': quote_plus(request.GET['next'], safe='/')}))
# Now encrypt it
r = Random.new()
iv = r.read(16)