login, logout, and Auth Views
Wire up Django's ready-made auth views.
From Verify to Logged In
Verifying a user is only step one. To keep them logged in across requests, you start a session with Django's login helper. 🔑
The login() Function
login() takes the request and an authenticated user, then saves their id in the session. Future requests now know who they are.
from django.contrib.auth import loginAll lessons in this course
- The User Model and authenticate()
- login, logout, and Auth Views
- Registration with UserCreationForm
- login_required and Protecting Views