Summary

In this chapter, we added user authentication to the blogging app. We created a User model, which securely stores a user's login credentials in the database, then built views for logging users in and out of the site. We added a signal handler that runs before every request and retrieves the current user, then learned how to use this information in the views and templates. In the second half of the chapter, we integrated the User model with the Entry model, making our blog more secure in the process. The chapter wrapped up with a brief discussion of Flask sessions.

In the next chapter, we will build an administrative dashboard that will allow super-users to perform actions such as creating new users and modifying site content. We will also ...

Get Learning Flask Framework 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.