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

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

parent f094ee66
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ from urllib.error import HTTPError ...@@ -10,6 +10,7 @@ from urllib.error import HTTPError
from postorius.models import List, MailmanUser from postorius.models import List, MailmanUser
from postorius.utils import get_mailman_client from postorius.utils import get_mailman_client
from allauth.account.models import EmailAddress
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -44,6 +45,14 @@ class Command(BaseCommand): ...@@ -44,6 +45,14 @@ class Command(BaseCommand):
logger.warning("update display_name on {} to {}".format(user.username, user.get_full_name())) 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].display_name = user.get_full_name()
mm_users[user.username].save() 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} 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.
Please register or to comment