Extending the application: brief requirements
With that, it's time to put it all in practice and extend our application. The requirements for this extension are simple. We want to:
Restrict the
/albums/recently-added
routes (both the GET and POST) to only authenticated users.We want to give the user the option for us to remember their username for future authentications.
We want to have a logout link that kills the user's session, and then prohibits them from gaining access to restricted routes until they re-authenticate.
If we break this down, there are a few work items for us. We need to create a login form that we'll use to get the user's credentials to authenticate, which should take the place of item 1. We can also satisfy item 2 by putting a classic Remember my username checkbox on the authentication form as well. Finally, we'll need to put a logout link somewhere on our site. No problemo! Let's get cracking!
Creating the login form
We're going to build the login form first because, hey...