I have a simple Flask App that uses bcrypt. I have spent several hours on this simple easy to use library to figure out the encoding issue. The login method calls doDecideHashedPassword method which then should return true or false if the credentials match.
Also note the following
- I use postgres and currently my password field is set to varchar(500)
- I convert the hashed password to str to store it accurately in database.
When I request the hashed password from the database, and pass it through the doDecodeHashedPassword below, I get invalid salt.This accepts email and password from the form.
def doDecodeHashedPassword(self, email, password):
getpwd = ClientUser.query.filter_by(email=email).one()
getpwd = getpwd.password
getpwd = getpwd.encode()
password = password
check_user_integrity = bcrypt.checkpw(password,getpwd)
if check_user_integrity:
return (check_user_integrity)
else:
return False
Why am I getting invalid salt error.