2013-10-14

I aim to create the easiest login experience possible for the users of my Django site. I imagine something like:

Login screen is presented to user

User selects to login with Facebook or Google

User enter password in external site

User can interact with my site as an authenticated user

Ok, this part is easy, just have to install django-allauth and configure it.

But I also want to give the option to use the site with a local user. It would have another step:

Login screen is presented to user

User selects to register

User enter credentials

Site sends a verification email

User clicks in email link and can interact with my site as an authenticated user

Ok, both the default authentication and allauth can do it. But now is the million dollars question.

If they change how they do the login, how do I automatically associate their Google, FB and local accounts?

See that any way they login, I have their email address. Is it possible to do it using django-allauth? I know I can do it with user intervention. Today the default behavior is to refuse the login saying that the email is already registered.

If it isn't possible to do just with configuration, I'll accept the answer that gives me some orientation about which modifications should I make in allauth code to support this workflow.

There are a lot of reasons to do this. The users will forget which method they used to authenticate, and will sometimes use Google, sometimes FB and sometimes the local user account. We already have a lot of local user accounts and social accounts will be a new feature. I want the users to maintain their identity. I envision the possibility to ask for the user friends list, so if they logged using Google, I'd like to also have their FB account.

It is a hobby site, there isn't great security requirements, so please don't answer that this isn't a wise security implementation.

Later, I'd create a custom user model to have just the email as the login id. But I'll be happy with an answer that just let me automatically associate a accounts of the default user model that has a required username.

I'm using Django==1.5.4 and django-allauth==0.13.0

Show more