I was looking around the documentation for django-social-auth but I can't seem to find a setting that will enforce unique emails for user accounts.
Is there any way of accomplishing this?
I was looking around the documentation for django-social-auth but I can't seem to find a setting that will enforce unique emails for user accounts.
Is there any way of accomplishing this?
I believe the answer can be found in this other question.
It says to put another step in edit the SOCIAL_AUTH_PIPELINE. I believe this this is a simpler solution.
The easiest thing to do is subclass the UserManager
class, and overwrite its create_user
method to check that there isn't a User
instance with that email address in the database (django-social-auth
uses create_user
to...create users on registration). A bit more on how to set this up is on the Configuration page of the django-social-auth
docs. You'll then need to subclass User
as well, so that you can associate the custom manager with it. More on model Managers from the Django docs.