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.
I faced the same problem. My arse was on fire because of deadline, hence I figured out a way around. Thought of sharing. I took the user instance by using the filter and then populated the POST by copying the data from original request.
self.user = User.objects.get(email=request.POST['email'])
then
self.request.POST = self.request.DATA.copy()
I was using REST Request objects, hence the DATA
. You can create another mutable POST object using some method.Note that original POST is immutable and you can't add anything into it. And then finally
self.request.POST['login'] = self.user.username
and then calling the form_valid
of LoginView
.
Hope this helps.
I had to switch to username password for the login in the end but thanks for the input I'll probably use that sometime in a coming project.
Same problem. I am using email only login at the moment and suddenly the app was failing. I added this to settings (for email only) via the allauth docs:
ACCOUNT_AUTHENTICATION_METHOD = "email"
Everything snapped back together. HTH!