summaryrefslogtreecommitdiff
path: root/django/archives/auth.py
diff options
context:
space:
mode:
authorMagnus Hagander2019-01-03 20:52:58 +0000
committerMagnus Hagander2019-01-04 11:24:06 +0000
commit69af766f8fae8ef489d951c71a37966fc51d736b (patch)
tree1e394a959d7ec9b49797b6cb74ec2eac5dbd47e8 /django/archives/auth.py
parent1e165224612094e7605d9109e70a3034a0f5a864 (diff)
Whitespace fixes
Diffstat (limited to 'django/archives/auth.py')
-rw-r--r--django/archives/auth.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/archives/auth.py b/django/archives/auth.py
index bcb349c..6ccf131 100644
--- a/django/archives/auth.py
+++ b/django/archives/auth.py
@@ -35,6 +35,7 @@ from Crypto.Hash import SHA
from Crypto import Random
import time
+
class AuthBackend(ModelBackend):
# We declare a fake backend that always fails direct authentication -
# since we should never be using direct authentication in the first place!
@@ -62,7 +63,7 @@ def login(request):
r = Random.new()
iv = r.read(16)
encryptor = AES.new(SHA.new(settings.SECRET_KEY.encode('ascii')).digest()[:16], AES.MODE_CBC, iv)
- cipher = encryptor.encrypt(s + ' ' * (16-(len(s) % 16))) # pad to 16 bytes
+ cipher = encryptor.encrypt(s + ' ' * (16 - (len(s) % 16))) # pad to 16 bytes
return HttpResponseRedirect("%s?d=%s$%s" % (
settings.PGAUTH_REDIRECT,
@@ -72,6 +73,7 @@ def login(request):
else:
return HttpResponseRedirect(settings.PGAUTH_REDIRECT)
+
# Handle logout requests by logging out of this site and then
# redirecting to log out from the main site as well.
def logout(request):
@@ -79,6 +81,7 @@ def logout(request):
django_logout(request)
return HttpResponseRedirect("%slogout/" % settings.PGAUTH_REDIRECT)
+
# Receive an authentication response from the main website and try
# to log the user in.
def auth_receive(request):
@@ -120,7 +123,7 @@ def auth_receive(request):
changed = True
if user.email != data['e'][0]:
user.email = data['e'][0]
- changed= True
+ changed = True
if changed:
user.save()
except User.DoesNotExist:
@@ -221,6 +224,7 @@ def user_search(searchterm=None, userid=None):
return j
+
# Import a user into the local authentication system. Will initially
# make a search for it, and if anything other than one entry is returned
# the import will fail.