Adding Authentication to the Blog App
In the last post, we developed a very basic blog application using Happstack. Now that we have a simple application without an authentication mechanism, let's see how much effort it takes to add authentication using the Happstack-Auth module mentioned here . First let's make an outline of what needs to be done. We need the following pieces of functionality: Pages for login/registration Routines to handle the POSTed form data from the above A page to log the user out Blog posts should contain the name of the author Only authenticated users should be able to create new posts. The first thing we have to do is import the auth module. > import Happstack.Auth Let's start by looking at the first three bullets of functionaliy mentioned above. I'll implement the login/registration pages in pretty much the same way they were implemented in my old posts. A single login.html file will have a form for both registration and login. This suggests the following cod...