Skip to content
Snippets Groups Projects
Commit bbb6dce5 authored by nd's avatar nd
Browse files

Merge branch 'mail-verify' into 'master'

set user mail adress to verified if it matches the one in ldap

See merge request !1
parents f094ee66 4e92f802
No related branches found
No related tags found
1 merge request!1set user mail adress to verified if it matches the one in ldap
......@@ -10,6 +10,7 @@ from urllib.error import HTTPError
from postorius.models import List, MailmanUser
from postorius.utils import get_mailman_client
from allauth.account.models import EmailAddress
logger = logging.getLogger(__name__)
......@@ -44,6 +45,14 @@ class Command(BaseCommand):
logger.warning("update display_name on {} to {}".format(user.username, user.get_full_name()))
mm_users[user.username].display_name = user.get_full_name()
mm_users[user.username].save()
# set user mail adresses to verified if they match those in ldap
user_emails = EmailAddress.objects.filter(user=user)
for mail in user_emails:
if mail.email == user.email:
logger.warning("update email.verified on user {} for address {} to True".format(user.username, mail.email))
mail.verified = True
mail.save()
mailman_id2username = {mm_users[i].user_id: i for i in mm_users}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment