Exemplo n.º 1
0
   def handle(self, request, context):
       id = context.get('id', None) 
       email = context.get('email',None)
       password = context.get('new_password',None)
       old_password = context.get('old_password',None)
       oldpassword = context.get('oldpassword',None)
       try:
           if password != '':
               encrypted_pwd = make_password(password)
               if check_password(old_password,oldpassword):
                   user_pwd = User.objects(id = id).update(set__password = encrypted_pwd)
               else:
                   return False
           if email is not None:
               try:
                   email_name, domain_part = email.strip().split('@', 1)
               except ValueError:
                   pass
           else:
               email = '@'.join([email_name, domain_part.lower()])
           user_email = User.objects(id = id).update(set__email = email)
           return True
 
       except Exception,e:            
           messages.error(request,_(e.message))
           LOG.error(e.message)
Exemplo n.º 2
0
   def handle(self, request, context):
       id = context.get('id', None) 
       password = context.get('new_password',None)
       try:
           if password is not None:
               encrypted_pwd = make_password(password)
               user_pwd = User.objects(id = id).update(set__password = encrypted_pwd)
           return True
 
       except Exception,e:
           messages.error(request,_(e.message))
           LOG.error(e.message)