Mercurial > p > roundup > code
diff roundup/password.py @ 1583:caae7d8934dc
set new email rego user password to random string
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 10 Apr 2003 05:12:42 +0000 |
| parents | 2e557762ee87 |
| children | dc43e339e607 |
line wrap: on
line diff
--- a/roundup/password.py Thu Apr 10 05:11:58 2003 +0000 +++ b/roundup/password.py Thu Apr 10 05:12:42 2003 +0000 @@ -15,13 +15,13 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: password.py,v 1.8 2002-12-18 23:57:09 richard Exp $ +# $Id: password.py,v 1.9 2003-04-10 05:12:41 richard Exp $ __doc__ = """ Password handling (encoding, decoding). """ -import sha, re, string +import sha, re, string, random try: import crypt except: @@ -48,6 +48,10 @@ raise ValueError, 'Unknown encryption scheme "%s"'%scheme return s +def generatePassword(length=8): + chars = string.letters+string.digits + return ''.join([random.choice(chars) for x in range(length)]) + class Password: '''The class encapsulates a Password property type value in the database.
