See #1039: resend confirmation email on login if email is unverified

This commit is contained in:
Eliot Berriot 2020-04-01 15:24:40 +02:00
parent 372bd4a6ee
commit b07bd83fa1
No known key found for this signature in database
GPG key ID: 6B501DFD73514E14
9 changed files with 82 additions and 11 deletions

View file

@ -43,9 +43,11 @@ class ModelBackend(backends.ModelBackend):
return user if self.user_can_authenticate(user) else None
def user_can_authenticate(self, user):
return super().user_can_authenticate(
user
) and not authentication.should_verify_email(user)
can_authenticate = super().user_can_authenticate(user)
if authentication.should_verify_email(user):
raise authentication.UnverifiedEmail(user)
return can_authenticate
class AllAuthBackend(auth_backends.AuthenticationBackend, ModelBackend):