In my website it is possible to login through:
- username and password
- e-mail and password
- google auth 2
Where I am using django user built in system and python social auth.
The problem:
Suppose I create the following account:
username: losimonassi e-mail: [email protected]
Then when I try to login with my gmail ([email protected]) python social auth creates another user with the same e-mail. So, when I try to login using my e-mail the auth system finds two similar e-mails which raises an error.
I am trying to find a way that when the user try to login with gmail his e-mail is checked against the DB and if it already exists the process is stopped with a redirect and a alert message (I think it could be made through the middleware).
But of course the checking against the DB should only check against other backends users and normal users, to avoid blocking his own login.
I don't want to associate the accounts.
settings.py
SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'social.pipeline.user.create_user',
#'social.pipeline.social_auth.associate_user',
#'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details'
)