diff --git a/source/users.rst b/source/users.rst index 9b3defd..b4331e3 100644 --- a/source/users.rst +++ b/source/users.rst @@ -267,8 +267,8 @@ before being stored. return self._password @password.setter - def _set_password(self, plaintext): - self._password = bcrypt.generate_password_hash(plaintext) + def password(self, plaintext): + self._password = bcrypt.generate_password_hash(plaintext).decode("utf-8") We're using SQLAlchemy's hybrid extension to define a property with several different functions called from the same interface. Our setter @@ -337,7 +337,7 @@ the hashed password stored for that user. # [...] columns and properties - def is_correct_password(self, plaintext) + def is_correct_password(self, plaintext): return bcrypt.check_password_hash(self._password, plaintext)