Changeset 0290330 for asadb/mit


Ignore:
Timestamp:
Dec 24, 2012, 3:28:00 AM (13 years ago)
Author:
MIT Association of Student Activities <asa@…>
Branches:
master, space-access, stable, stage
Children:
d0c7563
Parents:
161ce5f
git-author:
Alex Dehnert <adehnert@…> (12/24/12 03:28:00)
git-committer:
MIT Association of Student Activities <asa@…> (12/24/12 03:28:00)
Message:

Set a password of UNUSABLE_PASSWORD

  • 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/mit/__init__.py

    rb42118c r0290330  
    55import ldap.filter
    66
     7from django.contrib.auth.backends import RemoteUserBackend
     8from django.contrib.auth.hashers import UNUSABLE_PASSWORD
    79from django.contrib.auth.middleware import RemoteUserMiddleware
    8 from django.contrib.auth.backends import RemoteUserBackend
    910from django.contrib.auth.views import login
    1011from django.contrib.auth import REDIRECT_FIELD_NAME
     
    8384    def configure_user(self, user, ):
    8485        username = user.username
    85         user.password = "ScriptsSSLAuth"
     86        user.password = UNUSABLE_PASSWORD
    8687        con = ldap.open('ldap-too.mit.edu')
    8788        con.simple_bind_s("", "")
Note: See TracChangeset for help on using the changeset viewer.