Sean Callan over the Bakery blog has posted a guide, giving the CakePHP framework users ideas to set up a basic user authentication system for their application. This tutorial covers aspects of MVC in an authentication role, logging a user in, maintaining a session, and restricting unauthorized access to controller actions, he informs.
The tutorial is divided into three sections:
- Database: in this section, Sean creates a table in the database and configures the app/database.php file. He provides a basic schema to get you started.
- Model: in this section, he creates an User model. As the model is used only to check user information it is pretty basic, he says. But all logic and calculations in an MVC environment should take place inside the model, so the function
validateLogin($data)is used with the example code, he explains. - View: the third section deals with view . He says the views are straightforward and should be customized to fit the site needs. He provides self-explanatory code for this section.
He concludes by saying that this tutorial should provide a basic understanding on how to manage user logins and restrict access to certain pages based on login status. This article, he comments is in no way meant for an advanced audience, but rather to help those who have some experience with Cake but are unfamiliar with authentication and
beforeFilters.




