X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FResetPassword.py;h=8e9da53a2a40cbede83721d8a301f7b114b2e450;hb=e70e20fdbececafef842ec7b330fd48db42e614e;hp=367b7c8895c17370bb1769ac23eca19534674ad8;hpb=41063c2352286a103b95821293a961f219900f39;p=plcapi.git diff --git a/PLC/Methods/ResetPassword.py b/PLC/Methods/ResetPassword.py index 367b7c8..8e9da53 100644 --- a/PLC/Methods/ResetPassword.py +++ b/PLC/Methods/ResetPassword.py @@ -3,7 +3,9 @@ import base64 import time import urllib -from PLC.Debug import log +from types import StringTypes + +from PLC.Logger import logger from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed @@ -33,15 +35,21 @@ class ResetPassword(Method): Auth(), Mixed(Person.fields['person_id'], Person.fields['email']), - Person.fields['verification_key'], + Person.fields['verification_key'], Person.fields['verification_expires'] ] returns = Parameter(int, '1 if verification_key is valid') 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]) + # Get account information + # 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] @@ -111,9 +119,9 @@ class ResetPassword(Method): Subject = message['subject'] % params, Body = message['template'] % params) else: - print >> log, "Warning: No message template '%s'" % message_id + logger.warning("No message template '%s'" % message_id) - # Logging variables + # Logging variables self.event_objects = {'Person': [person['person_id']]} self.message = message_id