Previously we added a luggin page and used this to restrict access to the new article page.
In the logon script to log in the user were checking the username and password that they tapped into
the far on Match hard coded values having hard coded values like this in a script isn't a good idea.
As if we want to change them we need to change the code.
Plus only one user can log in.
Let's change this so that we check the username and password against user data in the database.
First let's create a new class kalid User Doug P. H.
P. where we can store all user related code in here.
Will define a new class called a user and then let's add a method to our thing to cater user which will
define as static as we don't have an instance of a user object in our luggin page.
The user is supplying a username and password.
So that's what we need to supply as arguments to the authenticate method.
For now let's just copy what we're doing in the luggin script checking that the values of the user name
and password arguments match some hard coded values so inside the method if the arguments match these
values we return TRUE and FALSE.
If they don't we'll replace these values later on.
Let's not forget to add a p p duck comment block to the method and also to the class.
Then in our luggin script.
First let's require the class at the top and then replace this line with a call to the New our centre
cake method in the User class passing in the values from the farm.
And in the browser the logging still works as before.