From 90a9c8342a4f5bcf02e6407dcf4ed1975ad15baf Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Wed, 17 Jan 2007 22:09:32 +0000 Subject: [PATCH] - overloading verification_key for account verification as well (i.e., before they are enabled); so only allow reset of enabled accoutns - use new Unicode clean sendmail interface - fix typo --- PLC/Methods/ResetPassword.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PLC/Methods/ResetPassword.py b/PLC/Methods/ResetPassword.py index dd76a03..1486a82 100644 --- a/PLC/Methods/ResetPassword.py +++ b/PLC/Methods/ResetPassword.py @@ -49,6 +49,9 @@ class ResetPassword(Method): if person['peer_id'] is not None: raise PLCInvalidArgument, "Not a local account" + if not person['enabled']: + raise PLCInvalidArgument, "Account must be enabled" + # Be paranoid and deny password resets for admins if 'admin' in person['roles']: raise PLCInvalidArgument, "Cannot reset admin passwords" @@ -104,11 +107,11 @@ class ResetPassword(Method): 'email': person['email']} sendmail(self.api, - To = "%s %s <%s>" % (person['first_name'], person['last_name'], person['email']), - Subject = message['subject'], + To = ("%s %s" % (person['first_name'], person['last_name']), person['email']), + Subject = message['subject'] % params, Body = message['template'] % params) else: - print >> log, "Warning: No message template '%s'" % message-id + print >> log, "Warning: No message template '%s'" % message_id # Logging variables self.object_ids = [person['person_id']] -- 2.43.0