Author: mtredinnick
Date: 2007-04-25 04:34:29 -0500 (Wed, 25 Apr 2007)
New Revision: 5073

Modified:
   django/trunk/AUTHORS
   django/trunk/django/contrib/auth/models.py
   django/trunk/docs/authentication.txt
Log:
Fixed #3316 -- Added support for crypt hashing of passwords, mostly to support
easy porting from existing Unix-based legacy apps. Thanks, [EMAIL PROTECTED]


Modified: django/trunk/AUTHORS
===================================================================
--- django/trunk/AUTHORS        2007-04-25 08:49:57 UTC (rev 5072)
+++ django/trunk/AUTHORS        2007-04-25 09:34:29 UTC (rev 5073)
@@ -49,6 +49,7 @@
     [EMAIL PROTECTED]
     David Ascher <http://ascher.ca/>
     Arthur <[EMAIL PROTECTED]>
+    [EMAIL PROTECTED]
     Jiri Barton
     Ned Batchelder <http://www.nedbatchelder.com/>
     Shannon -jj Behrens <http://jjinux.blogspot.com/>

Modified: django/trunk/django/contrib/auth/models.py
===================================================================
--- django/trunk/django/contrib/auth/models.py  2007-04-25 08:49:57 UTC (rev 
5072)
+++ django/trunk/django/contrib/auth/models.py  2007-04-25 09:34:29 UTC (rev 
5073)
@@ -17,6 +17,12 @@
     elif algo == 'sha1':
         import sha
         return hsh == sha.new(salt+raw_password).hexdigest()
+    elif algo == 'crypt':
+        try:
+            import crypt
+        except ImportError:
+            raise ValueError, "Crypt password algorithm not supported in this 
environment."
+        return hsh == crypt.crypt(raw_password, salt)
     raise ValueError, "Got unknown password algorithm type in password."
 
 class SiteProfileNotAvailable(Exception):

Modified: django/trunk/docs/authentication.txt
===================================================================
--- django/trunk/docs/authentication.txt        2007-04-25 08:49:57 UTC (rev 
5072)
+++ django/trunk/docs/authentication.txt        2007-04-25 09:34:29 UTC (rev 
5073)
@@ -204,9 +204,11 @@
 
 That's hashtype, salt and hash, separated by the dollar-sign character.
 
-Hashtype is either ``sha1`` (default) or ``md5`` -- the algorithm used to
-perform a one-way hash of the password. Salt is a random string used to salt
-the raw password to create the hash.
+Hashtype is either ``sha1`` (default), ``md5`` or ``crypt`` -- the algorithm
+used to perform a one-way hash of the password. Salt is a random string used
+to salt the raw password to create the hash. Note that the ``crypt`` method is
+only supported on platforms that have the standard Python ``crypt`` module
+available.
 
 For example::
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to