Encoding for Bcrypt in custom login tutorial

For anyone that stumbles on this looking for the answer, it’s answered over at Custom Signup Flow Error on Sign Up.

The working code is:

user[‘password_hash’] = bcrypt.hashpw(password.encode(), bcrypt.gensalt())

instead of:

user[‘password_hash’] = bcrypt.hashpw(password.encode(‘utf-8’), bcrypt.gensalt())
2 Likes