Give autocreated users a fake password (Trac: #38)
authorAlex Dehnert <adehnert@mit.edu>
Thu, 27 May 2010 00:15:03 +0000 (20:15 -0400)
committerAlex Dehnert <adehnert@mit.edu>
Mon, 6 Jun 2011 05:57:09 +0000 (01:57 -0400)
django/mit/__init__.py

index ff296a890c366166b4d6a9f5dde2b33a52d81888..acdb674cfc285dfb14ad86fa3872397fec6f1db2 100644 (file)
@@ -20,6 +20,7 @@ class ScriptsRemoteUserBackend(RemoteUserBackend):
             return username
     def configure_user(self, user, ):
         username = user.username
+        user.password = "ScriptsSSLAuth"
         import ldap
         con = ldap.open('ldap.mit.edu')
         con.simple_bind_s("", "")
@@ -34,9 +35,9 @@ class ScriptsRemoteUserBackend(RemoteUserBackend):
                 user.groups.add(auth.models.Group.objects.get(name='mit'))
             except ObjectDoesNotExist:
                 print "Failed to retrieve mit group"
-            user.save()
         try:
             user.groups.add(auth.models.Group.objects.get(name='autocreated'))
         except ObjectDoesNotExist:
             print "Failed to retrieve autocreated group"
+        user.save()
         return user