Mercurial > p > roundup > code
comparison roundup/password.py @ 1343:2e557762ee87
fixed handling of missing password [SF#655632]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 18 Dec 2002 23:57:09 +0000 |
| parents | c0a40d7ec47c |
| children | caae7d8934dc |
comparison
equal
deleted
inserted
replaced
| 1342:8de9e5940c30 | 1343:2e557762ee87 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: password.py,v 1.7 2002-09-26 13:38:35 gmcm Exp $ | 18 # $Id: password.py,v 1.8 2002-12-18 23:57:09 richard Exp $ |
| 19 | 19 |
| 20 __doc__ = """ | 20 __doc__ = """ |
| 21 Password handling (encoding, decoding). | 21 Password handling (encoding, decoding). |
| 22 """ | 22 """ |
| 23 | 23 |
| 29 pass | 29 pass |
| 30 | 30 |
| 31 def encodePassword(plaintext, scheme, other=None): | 31 def encodePassword(plaintext, scheme, other=None): |
| 32 '''Encrypt the plaintext password. | 32 '''Encrypt the plaintext password. |
| 33 ''' | 33 ''' |
| 34 if plaintext is None: | |
| 35 plaintext = "" | |
| 34 if scheme == 'SHA': | 36 if scheme == 'SHA': |
| 35 s = sha.sha(plaintext).hexdigest() | 37 s = sha.sha(plaintext).hexdigest() |
| 36 elif scheme == 'crypt' and crypt is not None: | 38 elif scheme == 'crypt' and crypt is not None: |
| 37 if other is not None: | 39 if other is not None: |
| 38 salt = other[:2] | 40 salt = other[:2] |
