Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django allauth email login - always wrong

If I change my allauth authentication method to email in django settings I always get the following error:

The e-mail address and/or password you specified are not correct.

Even though the email matches the one in the database.

I tried this in a clean django project using the following settings:

ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "optional"

I set email verification to optional to eliminate a source for the error but the issue remains regardless of whether or not I confirm the email address.

like image 813
matteok Avatar asked Jan 15 '15 15:01

matteok


3 Answers

Had same issue today, my solution was that I was missed the AUTHENTICATION_BACKENDS step when installing allauth.

Ensure you have the following in your settings.py

AUTHENTICATION_BACKENDS = (
    # Needed to login by username in Django admin, regardless of `allauth`
    "django.contrib.auth.backends.ModelBackend",
    # `allauth` specific authentication methods, such as login by e-mail
    "allauth.account.auth_backends.AuthenticationBackend"
)

See http://www.sarahhagstrom.com/2013/09/the-missing-django-allauth-tutorial for a helpful guide

like image 193
wjdp Avatar answered Nov 14 '22 05:11

wjdp


Had the same issue today and none of the above solutions helped. The issue was coming from a custom login template I used to display input fields.

So either use the default way to render forms or make sure you are using login as a name for your email input field :

<input type="email" name="login" required="">
<input type="password" name="password" required=""> 

I previously was using email which was throwing an error

Login doesn't exists

like image 43
GCL Avatar answered Nov 14 '22 07:11

GCL


I know this is an old post but in case anyone comes across it. These are all the setting in settings.py i added in order to enable email login

ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
like image 1
user2782162 Avatar answered Nov 14 '22 05:11

user2782162