diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-04-25 09:34:29 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-04-25 09:34:29 +0000 |
| commit | 2a7d9ef23fff757d5aa8052c165cc189819e5ee2 (patch) | |
| tree | 205b1b294f4473a51b0c33ce3dd796d6d56d037d /django | |
| parent | 5dfe74f221f2e7c5dc7e5722bb322336c605c7b5 (diff) | |
Fixed #3316 -- Added support for crypt hashing of passwords, mostly to support
easy porting from existing Unix-based legacy apps. Thanks, axiak@mit.edu.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5073 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/auth/models.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index 6fe781a041..9ebef0f524 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -17,6 +17,12 @@ def check_password(raw_password, enc_password): 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): |
