User Login with Flask_Login - Flask Fridays #22

Codemy.com August 13, 2021
Video Thumbnail
John Elder Logo

John Elder

@johnelderai

About

AI is taking over the world...let's get into it! OpenClaw, Claude Code, Manus, Perplexity, and whatever other weird AI stuff that comes along with a pinch of Python Programming thrown in from time to time. Check out my website JohnElder.AI and Codemy.com for more videos!

Video Description

In this video I'll show you how to set up user Login with Flask_Login and Python. We'll start out adding a Username field to our Users Table. After we migrate the database, we'll update the web forms to handle username. Then we'll install and set up Flask_login that will handle logging in, logging out, sessions, and all the good things. We'll also create a user dashboard that will only appear if a user is logged in. #flask #codemy #JohnElder Timecodes 0:00​​ - Introduction 1:17 - pip install flask_login 2:50 - import flask_login to app 3:17 - Add UserMixin to User Model 3:48 - Add Username To Users Model 4:33 - Make DB Migration 5:03 - Add Username Field UserForm 5:32 - Add Username Field Add_User View 6:21 - Add Username Field To Web Form 7:12 - Add Username To Webpage 8:00 - Create Login.html Template 9:11 - Create Dashboard.html Template 9:46 - Create Login Route and View 10:36 - Create Dashboard Route and View 11:02 - Create LoginForm 12:10 - Add Login Link To Navbar 13:06 - Add Flask_login Configuration 13:57 - @login_manager.user_loader 15:03 - Make Dashboard @Login_required 15:42 - Validate Login Form 17:00 - Check Password Hash 18:51 - Show Flash Messages 19:54 - Test It Out! 20:33 - Create Logout Functionality 21:54 - Add Logout Link To Dashboard 22:26 - Conclusion