Signing In and Out
Django provides the views. django.contrib.auth.urls gives you login, logout, and the whole password reset flow. You supply templates; the logic is done.
Writing your own login view is a reasonable exercise once. Shipping your own is rarely a good idea.
Three functions worth knowing.
authenticate(request, username=..., password=...) returns a user or None. It checks; it does not sign anyone in.
login(request, user) starts the session.
logout(request) ends it and flushes the session data.
Signing up is UserCreationForm, then usually login() immediately afterwards so the person is not asked to type what they just chose.
Mark this lesson complete
Signed in, your progress follows you to every device.