def is_username_valid(self, username_field): userdata = UserData() return False if userdata.find_by_prop("username", username_field) else True
def is_email_valid(self, email_field): userdata = UserData() return False if userdata.find_by_prop("email", email_field) else True
def insert_one(user): user.password = generate_password_hash(user.password) UserData.create_user(user)
def find_by_id(userid): user = UserData.find_by_id(userid) return Usuario(user["username"], user["email"], user["_id"]) if user else None
def check_password(password, username): pwhash = UserData.get_user_password(username) return check_password_hash(pwhash, password)
def find_by_username(self, username): userdata = UserData() return userdata.find_by_username(username)
def insert_one(self, user): userdata = UserData() userdata.create_user(user)