X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=auth%2Fbackend.py;h=0eb1f2d6e4cca7c002581fdacb0b237f6c6fb139;hb=8e75238a1113421aa3aedbac7aee315ed52fb92e;hp=a09ef608f4c1f48fd0a844c0c8d45f7ec2db6dc7;hpb=942f0c826530444332e45de0367b560e0af22b33;p=myslice.git diff --git a/auth/backend.py b/auth/backend.py index a09ef608..0eb1f2d6 100644 --- a/auth/backend.py +++ b/auth/backend.py @@ -18,7 +18,9 @@ class MyCustomBackend: # Create an authentication method # This is called by the standard Django login procedure - def authenticate(self, username=None, password=None): + def authenticate(self, token=None): + username=token['username'] + password=token['password'] users=MyCustomBackend.hard_wired_users if username not in users: return None if password != users[username]: return None @@ -26,8 +28,11 @@ class MyCustomBackend: # Check if the user exists in Django's local database user = User.objects.get(email=username) except User.DoesNotExist: + print 'creating django user',username # Create a user in Django's local database - user = User.objects.create_user(time.time(), username, 'passworddoesntmatter') + # warning: the trick here is pass current time as an id, and name as email + # create_user(username, email=None, password=None) + user = User.objects.create_user(time.time(), username, 'password-doesnt-matter') return user