I have a Cake website and it needs to have two separate logins, each one will have their own login form and see different pages, it would be nice to have two different tables because there are no similarities between the two types of people.
Each login form will only be used by certain people and they will never login to the other form, and vice versa.
Also, the two login tables have a relationship between them, which requires 2 tables?
Is this possible?
First, add a couple of empty custom authenticate objects. We’ll reuse the same logic that FormAuthenticate uses (that is, uses POST data to check the database for a user), but simply change the model within the object settings (later).
app/Controller/Component/Auth/ModelOneAuthenticate.php
app/Controller/Component/Auth/ModelTwoAuthenticate.php
Then tell your app to use these objects to authenticate, and tell it what model to use. You can also customize the fields here. In your AppController:
The first authentication object would check the
model_onestable for a username inmy_custom_username_fieldand password insome_password_field, while the second one would checkmodel_twosusing the standardusernameandpasswordfields.