Learn Flask: Accounts and Authentication
Let people sign up, log in and own their data. Hash passwords with Werkzeug, model members and register them with Flask-WTF, then use Flask-Login to log people in and out, protect routes, redirect safely and make sure members can only touch their own records. Every example is run against Flask 3.1, Flask-Login 0.6, Flask-WTF 1.3 and Flask-SQLAlchemy 3.1.
- Intermediate level
- 3 modules
- 5 lessons
- 30 quiz questions
Syllabus
01Storing AccountsKeep member passwords out of reach even if the database leaks: hash them with Werkzeug, then build a Member model and a validated registration form around that.2 lessons
02Logging In and OutUse Flask-Login to remember who is signed in, log members in and out safely, then guard pages, redirect people back to where they were headed and decide how long a login lasts.2 lessons
03Using AccountsTie records to the member who made them, refuse requests for anyone else's data, and give members clear feedback with flash messages.1 lesson