svn keywords
[plcapi.git] / PLC / Methods / ResetPassword.py
index 43ee8ba..b066529 100644 (file)
@@ -1,8 +1,12 @@
+# $Id$
+# $URL$
 import random
 import base64
 import time
 import urllib
 
+from types import StringTypes
+
 from PLC.Debug import log
 from PLC.Faults import *
 from PLC.Method import Method
@@ -39,11 +43,15 @@ class ResetPassword(Method):
 
     returns = Parameter(int, '1 if verification_key is valid')
 
-    object_type = 'Person'
-
     def call(self, auth, person_id_or_email, verification_key = None, verification_expires = None):
        # Get account information
-        persons = Persons(self.api, [person_id_or_email])
+        # we need to search in local objects only
+        if isinstance (person_id_or_email,StringTypes):
+            filter={'email':person_id_or_email}
+        else:
+            filter={'person_id':person_id_or_email}
+        filter['peer_id']=None
+        persons = Persons(self.api, filter)
         if not persons:
             raise PLCInvalidArgument, "No such account"
         person = persons[0]
@@ -116,7 +124,7 @@ class ResetPassword(Method):
             print >> log, "Warning: No message template '%s'" % message_id
 
        # Logging variables
-        self.object_ids = [person['person_id']]
+        self.event_objects = {'Person': [person['person_id']]}
         self.message = message_id
 
         return 1