Mark Sapiro writes: > Adding a hook to a user supplied password checker could be done in 2.2. > I'll take a look at this idea. How about a default checker that just > checks for minimum length defined in Defaults.py/mm_cfg.py, but > overridable by the site. or maybe an mm_cfg.CheckPassword() function > defined in Defaults.py as > > def CheckPassword(pwd): > if len(pwd) > 0: > return True > else: > return False > > Then the site can redefine this in mm_cfg.py to do anything they want.
It occurs to me that this API is going to make it hard to provide help to users. Maybe CheckPassword's API should be to raise an InvalidPasswordError with an appropriate reason, or alternatively to return a false value if nothing is wrong with the password, otherwise return a list of reasons it is invalid (ie, return 'reasons' in the example below). So I'd like to be able to do import re letter_re = re.compile("[a-zA-Z]") digit_re = re.compile("[0-9]") minimum_admin_password_length = 8 def MyCheckPassword(pwd): # require passwords to contain letters and digits reasons = [] if not re.search(letter_re,pwd): reasons.append("your password did not contain a letter") if not re.search(digit_re,pwd): reasons.append("your password did not contain a digit") if len(pwd) < minimum_admin_password_length: reasons.append("your password was not at least %d characters long" % \ (minimum_admin_password_length,)) if reasons: raise InvalidPasswordError(reasons) CheckPassword = MyCheckPassword > I think this should probably apply only to list and site passwords in > MM 2.2. Agreed. ------------------------------------------------------ Mailman-Users mailing list Mailman-Users@python.org http://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: http://mail.python.org/mailman/options/mailman-users/archive%40jab.org Security Policy: http://wiki.list.org/x/QIA9