0

I have an issue with a django allauth project

I typed that in settings.py to disable username field and use email address

SOCIALACCOUNT_QUERY_EMAIL = True
ACCOUNT_LOGOUT_ON_GET= True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_EMAIL_REQUIRED = True
SOCIALACCOUNT_LOGIN_ON_GET = True

when I register for the first time it successfull, but when i tries to register another user raised me error : UNIQUE constraint failed: auth_user.username

error with seccond register

I expect that happend because unique not effected to field

  • In Django Framework, the username is [required](https://docs.djangoproject.com/en/4.2/ref/contrib/auth/#django.contrib.auth.models.User.username), so AllAuth automatically provide something for the username. It takes the first part before the @ of the email as username if I remember correctly. – Philippe Sisowath May 20 '23 at 17:22
  • Have you used a custom user model? The configuration you used seems to be for a [custom user model](https://django-allauth.readthedocs.io/en/latest/advanced.html#custom-user-models) – Philippe Sisowath May 20 '23 at 17:34

0 Answers0