1

I am using django-allauth together with an LDAP-backend.

So whenever a users logs in, the mail address is set to the mail address stored in our directory server.

I was able to disable email confirmation by setting

ACCOUNT_EMAIL_VERIFICATION = "none"

But now those users have an unconfirmed mail address attached to their account. More specifically: I am trying to set up a mailman 3 including webUI and connect that to LDAP. Users having the mail address unconfirmed, causes them to not be able to use this address to subscribe to mailing lists.

Can I maybe somehow modify the AccountAdapter to automatically confirm mail addresses when a user logs in?

Racer
  • 534
  • 1
  • 6
  • 11

1 Answers1

0

I had the same problem, also with Mailman. The following AccountAdapter performs an auto-confirm for me:

from allauth.account.adapter import DefaultAccountAdapter
from allauth.account.models import EmailAddress
from allauth.account.utils import user_email

class NoNewUsersAccountAdapter(DefaultAccountAdapter):

    def is_open_for_signup(self, request):
        return False

    def login(self, request, user):
        super().login(request, user)
        email, created = EmailAddress.objects.get_or_create(
            user=user,
            email=user_email(user)
        )
        email.verified = True
        email.save()
stettberger
  • 61
  • 1
  • 2