* Changes ScriptsRemoteUserBackend's configure_user method to set the default
password to UNUSABLE_PASSWORD instead of ScriptsSSLAuth. UNUSABLE_PASSWORD
displays in the admin as "Password: None", instead of an ugly error message.
This should fix "Unknown password hashing algorithm" errors for users
correctly created in the future. (ASA-#132)
* Adds a migration to change current users with passwords of "" or
"ScriptsSSLAuth" to a password of UNUSABLE_PASSWORD ("!"). This will fix
ASA-#132 and the symptoms of ASA-#133 for already-existent users.
import ldap
import ldap.filter
import ldap
import ldap.filter
-from django.contrib.auth.middleware import RemoteUserMiddleware
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.backends import RemoteUserBackend
+from django.contrib.auth.hashers import UNUSABLE_PASSWORD
+from django.contrib.auth.middleware import RemoteUserMiddleware
from django.contrib.auth.views import login
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
from django.contrib.auth.views import login
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
return username
def configure_user(self, user, ):
username = user.username
return username
def configure_user(self, user, ):
username = user.username
- user.password = "ScriptsSSLAuth"
+ user.password = UNUSABLE_PASSWORD
con = ldap.open('ldap-too.mit.edu')
con.simple_bind_s("", "")
dn = "dc=mit,dc=edu"
con = ldap.open('ldap-too.mit.edu')
con.simple_bind_s("", "")
dn = "dc=mit,dc=edu"