Lesson 25. Capstone: Adding User Authentication to Confetti Cuisine

 

My contacts at Confetti Cuisine are delighted with the progress on their application. They’ve already started to add new course offerings, manage new subscribers, and spread the word about creating new user accounts. I warn them that although user accounts can be created, the application isn’t ready to handle users securely.

The client and I agree that data encryption and proper user authentication are the way forward, so for my next improvements to the application, I’m going to add a couple of packages that use Passport.js to assist in setting up a secure user-login process. I’ll also add flash messaging so that users can tell after a redirect or page render whether their last operation was successful. Then I’ll add some additional validations with the help of the express-validator middleware package.

By the end of this stage of development, I can comfortably encourage Confetti Cuisine to sign users up for their application. Because the application isn’t yet live online, though, the client will have to run it locally on their machines when users sign up.

For this capstone exercise, I’ll need to do the following:

  • Add sessions and cookies between page requests
  • Add new custom middleware for validations and setting up local variables in the views
  • Create a login form
  • Add passport authentication and encryption for the User model
  • Add a visual indicator to show which user is logged in

25.1. Getting set up

25.2. Creating a login form

25.3. Adding encryption with Passport.js

25.4. Adding flash messaging

25.5. Adding validation middleware with express-validator

25.6. Adding authentication with Passport.js

25.7. Logging in and out

Summary