Esempio n. 1
0
 def save_user(self, user: User):
     try:
         if (len(list(self.collection_users.find({"username": user.username})))==0):
             self.collection_users.insert_one(user.jsonify())
             return True
         return False
     except:
         return False
Esempio n. 2
0
    def modify_user(self, username: str, password: str, user: User):
        modify = self.collection_users.update_one(
            {
                "username": username,
                "password": password
            }, {"$set": user.jsonify()})
        if modify:
            return True

        return False