3
votes

Login username or password.

I want customers to login via "email" on the frontend and the admins to login via "username" on the backend (/admin page)

I came up with this solution:

In the users table there will be two fields, username and email.

If the customer try to login on the frontend, it will check their email, password and group_id = 0

For admin, it will check their username on group_id = 2

Is this the correct way?

1
Off-course it's a correct way, business requirements - this is how you have to do it. - Rakesh Sankar
i see no problems here, that's correct - k102
@Rakesh, you said "business requirements" - is this a semi set thing? Do you have any reference to such document somewhere which you can share a link please? (I would love to read up on these things since I have no clue to what gets used outside... if you get what I am saying) - LouwHopley
@Nideo I see what you saying, it just a general term, all of us (software developers) who create software is to suit the business (clients) who brings the requirements (product or site) to give life. Not sure I could find some, but I will post it if I come across. - Rakesh Sankar

1 Answers

1
votes

Good enough ... will an admin require all the fields that are available for a cusomter? If not you might considering creating a specific table for the admin users since the table would not be in 3NF.

Other than that I don't see any issues :)