0

I want to enable user to login with username / password. I also want to allow user to enter email address for email verification use.

Here is my settings.py

ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = False
ACCOUNT_USERNAME_REQUIRED = True
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_USER_MODEL_USERNAME_FIELD = 'username'
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 1
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'

However, when I try to register. There will be an error message.

(1062, "Duplicate entry 'test@test.com' for key 'email'")

And I found that, there is a new entry in "auth_user" table. But it can't write to "account_emailaddress" table.

Also, I found that there is a configure in mysql for "account_emailaddress"

UNIQUE KEY `email` (`email`),

How can I disable the unique email setting?

I'm using python 3.4, django 2.0, django-allauth 0.35

Thanks!

user3114168
  • 325
  • 1
  • 3
  • 14

1 Answers1

0

You need to tell allauth in your settings.py- 'ACCOUNT_AUTHENTICATION_METHOD = "username_email" '

This should enable the verification and use of emails as login.