From 25b407e24fe21dc46a4f9efa77734d55e0ed4bdd Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Fri, 8 Apr 2011 22:02:49 -0400 Subject: encrypt_password(): New convenience function for ensuring that a password is both encrypted according to a scheme, and a bytes object. add_member(): Use encrypt_password(). cli_members: Give the user a default, user-friendly password. Of course, this will be encrypted so it can't be retrieved, but it can be reset. Passwords are stored as bytes objects, not unicode now. ConfigLayer: Set the default test password scheme to cleartext. General test repair. --- src/mailman/rest/adapters.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/mailman/rest/adapters.py') diff --git a/src/mailman/rest/adapters.py b/src/mailman/rest/adapters.py index 30ce99f44..5cbb89bc1 100644 --- a/src/mailman/rest/adapters.py +++ b/src/mailman/rest/adapters.py @@ -36,6 +36,7 @@ from mailman.interfaces.address import InvalidEmailAddressError from mailman.interfaces.listmanager import IListManager, NoSuchListError from mailman.interfaces.member import DeliveryMode from mailman.interfaces.membership import ISubscriptionService +from mailman.utilities.passwords import make_user_friendly_password @@ -84,15 +85,12 @@ class SubscriptionService: raise InvalidEmailAddressError(address) # Because we want to keep the REST API simple, there is no password or # language given to us. We'll use the system's default language for - # the user's default language. We'll set the password to None. XXX - # Is that a good idea? Maybe we should set it to something else, - # except that once we encode the password (as we must do to avoid - # cleartext passwords in the database) we'll never be able to retrieve - # it. - # + # the user's default language. We'll set the password to a system + # default. This will have to get reset since it can't be retrieved. # Note that none of these are used unless the address is completely # new to us. - return add_member(mlist, address, real_name, None, mode, + password = make_user_friendly_password() + return add_member(mlist, address, real_name, password, mode, system_preferences.preferred_language) def leave(self, fqdn_listname, address): -- cgit v1.2.3-70-g09d2