flask-bcrypt - ValueError: Invalid salt

后端 未结 11 1477
北海茫月
北海茫月 2020-12-29 07:57

I was finishing up a simple user login with Flask and flask-Bcrypt. However, when trying to login with a user that is stored in my database, I keep getting this error

<
11条回答
  •  执念已碎
    2020-12-29 08:30

    You need to apply .decode('utf-8') to your self.password:

    def set_password(self, password):
        """Set password."""
        self.password = bcrypt.generate_password_hash(password).decode('utf-8')
    

提交回复
热议问题