def update_password(self, user_id, password: PasswordTicket): """ Update password Args: user_id (ID): User ID password (PasswordTicket): Object for validating password """ result = self.__user_data.update_password( user_id, self.__encrypt_password(password.get())) if not result.get_status(): raise UserUpdateError("Could not update password")
def create(self, username: UsernameTicket, password: PasswordTicket, names: NameTicket) -> User: """ Create user Args: username (UsernameTicket): Object that validates username password (PasswordTicket): Object that validates password names (NameTicket): Object that validates first and last name Returns: User """ result = self.__user_data.insert( **{ "username": username.get(), "password": self.__encrypt_password(password.get()), "first_name": names.get_first_name(), "last_name": names.get_last_name(), "status_id": self.__statuses.ACTIVE.get_id() }) if not result.get_status(): raise UserCreateError("Could not create user") return self.get(result.get_insert_id())