I have a table email_addresses and a table users. I am using the users email address as their username. So the users table would be something like:
email_address_id
password
The email_address_id field would just find the email in the email_addresses table for the username as login information.
I understand I can change the username field to another name like email_address with the auth component, but how would I use a field from a different table as a username?
Right now I have to insert the email in the email table AND the user table which seems like really bad database design.
Any help would be appreciated!
I’m using CakePHP 2.0.5
Do you really need to do this? It’s good to keep things that belongs together, together.
I would keep the email in the User model for authentication.
Use email_addresses for subsequent emails if that’s what you want.
Edit:
Now if some people are granted access and other not, I would add a field in the User model, something like has_access int(1) or whatever speaks to you and check it’s value at login.