Now that we know how to store passwords more securely, let's amend our create method to hash our passwords before storing them in the database. Firstly, at the top of our users.py dependency file, let's add bcrypt to our imports and add a new constant:
import bcrypt HASH_WORK_FACTOR = 15
Our new constant, HASH_WORK_FACTOR will be used for the rounds argument that gensalt uses. I've set it to 15, which will cause it to take slightly longer to create password hashes and check passwords, but it will be more secure. Please feel free to set this as you wish; just bare in mind that the more you increase this, the longer it will take for our application to create and authenticate users later on.
Now, outside any classes, ...