views:

75

answers:

5

We are trying to develop a system where a person creates an account where the username is the person's email address. The problem is, the person can have his own unique account (where he is the admin), plus be a "user" of someone else's account.

The "admin" of an account would be able to assign a person's email address to their account plus create a password for that person to log in as a user.

In MySQL, we are having a problem trying to identify what account to log the person into since the email address is the unique identifier. Is there a better way of doing this?

Obviously, using unique usernames for each account a person was assigned to would solve this issue but we were hoping to use one email address since it would be less to remember for a user.

Any help would be appreciated!

A: 

If there are 2 accounts for the same user (e-mail address) ask which one he wants to be logged in. Just an idea...

Leniel Macaferi
Yep, this was our first thought...we were just hoping there was a solution that would allow us to eliminate that step.
Chad
A: 

You need to give the user a way to tell which account he wants to login to. You could for example have a dropdown next to the login form, where the user can choose between login as an admin or as a guest.

Otherwise, you could have a second screen after the login form where the user chooses the two options.

In any case, if you don't use two separate username (or passwords, by the way), you cannot know which account the user wants to login to,

Wookai
+5  A: 
Charles Bretana
My thoughts exactly.
Matt Ball
Mine too. It sounds more like a user roles and permissions problem than an identification or authentication problem.
Mike
I don't see the point in maintaining separate, identical accounts for the sake of distinguishing between application privileges. The more roles the application needs, it becomes more apparent how flawed this design approach is.
OMG Ponies
@OMG, what part of 'separate' do you not understand <grin>. Separate means that the accounts and Users are separate entities, separte objects, separate tables, etc. Thre is no need to duplicate them...
Charles Bretana
@Charles: Watch as people interpret that as meaning the need for ADMIN specific tables...
OMG Ponies
@Charles Thanks for your reply. This is actually what we were thinking of doing. Actually, I believe this is how Google's AdWords MCC account works. However, we were hoping there was a solution to remove the needed user input of selecting what account they wanted to access.
Chad
@OMG, I see... you might be right... obviously not what I intended. But if you see a way to edit to eliminate that ambiguity, go for it...
Charles Bretana
A: 

The "admin" of an account would be able to assign a person's email address to their account plus create a password for that person to log in as a user.

In this case i think it would be better to move the users to another table says account_users and associate with the persons table through the primary key id or username in your case. This way one admin can create many users, even if any of the user is an existing admin. Dont know if this would be the best way though ?

naiquevin
A: 

A common method in determining which account to login under is to have account subdomains. This works particularly well for "company centric" web apps.

In other words, if a user has an account for Company XYZ, their account address could be companyxyz.webapp.com. The subdomain could be auto-generated or chosen at signup. With account subdomains, user logins only need to be unique within a given account subdomain.

Evan Owen
I thought of doing this as well. The only problem is, a user might be assigned to more than one account, lets say 6. The user would have to remember 6 domains - instead of 6 usernames...not much of an improvement unless, of course, they used bookmarks. It is a decent idea though. Thanks!
Chad