Authenticating users (Advanced)
So far we have assumed that anyone who can access the
sched application should be able to create, display, edit, list, and delete appointment records in the database. Our Flask application needs to authenticate users and protect our database.
We return to the
models.py file inside the
sched directory of our project.
How to do it...
- We start with a database record for the user with a unique e-mail address, in
from datetime import datetime from sqlalchemy import Column from sqlalchemy import Boolean, DateTime, Integer, String from sqlalchemy.orm import synonym from sqlalchemy.ext.declarative import declarative_base from werkzeug import check_password_hash from werkzeug import generate_password_hash ...