19.6 Putting It All Together

This chapter is the tip of the iceberg when it comes to auth. We learned about sessions and cookies, took a quick look at some of the tools provided by the auth app, and then built two very straightforward webpages.

The User model is the heart of the auth app, and while we did not interact with it directly, both the login() and logout() views are manipulating the user data sent as part of the HttpRequest object. The views will receive either a User or an AnonymousUser.

When login() receives the POST data from AuthenticationForm, it finds a user by the same username and then uses the check_password() method provided by the User class. In the event the password matches the hash stored in the database, then the login() ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.