June 2017
Intermediate to advanced
446 pages
10h 10m
English
For user authentication security, we will use Flask's extension httpauth, written by Miguel Grinberg, as well as the password functions in Werkzeug. The httpauth extension should have been installed as part of the requirements.txt installation in the beginning of the chapter. The file is named chapter9_9.py; we will start with a few more module imports:
...from werkzeug.security import generate_password_hash, check_password_hashfrom flask.ext.httpauth import HTTPBasicAuth...
We will create an HTTPBasicAuth object as well as the user database object. Note that during the user creation process, we will pass the password value; however, we are only storing password_hash instead of the password itself:
auth = HTTPBasicAuth()class User ...
Read now
Unlock full access