def verify_password(self, candidate): try: return Context.verify(candidate, self.password) except (ValueError, TypeError): return False
def set_password(self, new_password): self.password = Context.encrypt(new_password)