예제 #1
0
 def POST(self,username, oldpassword, newpassword):
     username = username.lower()
     if not REGEX_PASSWORD.match(newpassword):
         return to_json({'result': 2, 'description': 'Password can contain from 6 to 32 characters.'})
     res = self._database.change_password(username, oldpassword, newpassword)
     if res:
         return to_json({'result': 0, 'description': 'Password changed.'})
     else:
         return to_json({'result': 1, 'description': 'Changing password failed.'})
예제 #2
0
 def check_register_value(self, username, password, email, phone=None):
     if not REGEX_USERNAME.match(username):
         return False
     """dont allow register a guest username"""
     if REGEX_GUEST_USERNAME.match(username):
         return False
     if not REGEX_PASSWORD.match(password):
         return False
     if not REGEX_EMAIL.match(email):
         return False
     if phone:
         if not REGEX_PHONE.match(phone):
             return False
     return True
예제 #3
0
 def check_register_value(self, password, email):        
     if not REGEX_PASSWORD.match(password):
         return False
     if not REGEX_EMAIL.match(email):
         return False
     return True