diff --git a/designsafe/apps/auth/tasks.py b/designsafe/apps/auth/tasks.py index 10aad8d2f7..99f07e4738 100644 --- a/designsafe/apps/auth/tasks.py +++ b/designsafe/apps/auth/tasks.py @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +import requests from django.conf import settings from django.core.mail import send_mail from agavepy.agave import Agave, AgaveException @@ -96,6 +97,15 @@ def new_user_alert(username): 'Name: ' + user.first_name + ' ' + user.last_name + '\n' + 'Id: ' + str(user.id) + '\n', settings.DEFAULT_FROM_EMAIL, settings.NEW_ACCOUNT_ALERT_EMAILS.split(','),) + + tram_headers = {"tram-services-key": settings.TRAM_SERVICES_KEY} + tram_body = {"project_id": settings.TRAM_PROJECT_ID, + "email": user.email} + tram_resp = requests.post(f"{settings.TRAM_SERVICES_URL}/project_invitations/create", + headers=tram_headers, + json=tram_body, + timeout=15) + tram_resp.raise_for_status() @shared_task()