def get_page(self, params): """Handle parameters for changing the password. param params: A dictionary that is expected to contain user_id and password entries. TypeError will be thrown when params is None. ValueError will be thrown if user_id or password are None/empty. """ def validate(): if params is None: raise TypeError def throw_if_empty(x): if params.get(x, "") =="": raise ValueError(x) ps = ["user_id", "password"] list(map(throw_if_empty, ps)) validate() interactor = self.interactor_factory.create("ChangePasswordInteractor") interactor.interactor_factory = self.interactor_factory interactor.set_hash_provider(BCryptHashProvider()) u = User() u.user_id = params["user_id"] u.password = params["password"] interactor.execute(u)
def __get_user(self, user_id="user", password="******", id="id"): u = User() u.user_id = user_id u.password = password u.id = id return u