In this section, we'll refactor our existing application in order to enable it to act as a forum. And, chances are high that it won't be necessary to learn anything new; we'll just re-use the skills gathered so far; but we'll also use the parsing commodities that Play! 2 offers us.
The very first thing we have to do is to enable a user to log in; this ability was already created in the Data
controller. However, for that, we'll update our Application
controller a bit, to create a new index
action that will check whether a user is logged in or not.
So, index
is now the new entry point of the application and can be routed from /
in the routes
file. And, it's solely meant to check if a user has logged in or not. This check is based on the session content, as we simply check whether a user's e-mail is present in the session.