From b7c7566339df0ddf6fb3ceec9da9224fd8753e19 Mon Sep 17 00:00:00 2001 From: Wesley B <62723358+wesleyboar@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:36:36 -0600 Subject: [PATCH 1/2] docs: update URL for sample JIRA task (#389) * docs(pull_request_template): new sample JIRA task - JIRA URL has changed. - XYZ is obviously wrong. - 1234 could be skipped. So, use XYZ, to better suggest change. * style: npx nx format:write --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 5eac54d3c..d3ba6a93a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,7 +2,7 @@ ## Related -- [TUP-1234](https://jira.tacc.utexas.edu/browse/TUP-1234) +- [TUP-XYZ](https://tacc-main.atlassian.net/browse/TUP-XYZ) ## Changes From b9e187f1e7b826f6db20cf305b1d9e2d23a7363d Mon Sep 17 00:00:00 2001 From: Jake Rosenberg Date: Tue, 12 Dec 2023 13:19:53 -0600 Subject: [PATCH 2/2] send an email when users submit a form --- apps/tup-cms/src/apps/portal/apps.py | 22 +++++++++++++++++++ .../src/taccsite_cms/settings_custom.py | 3 +++ 2 files changed, 25 insertions(+) diff --git a/apps/tup-cms/src/apps/portal/apps.py b/apps/tup-cms/src/apps/portal/apps.py index f669ed6a5..2d336e6e2 100644 --- a/apps/tup-cms/src/apps/portal/apps.py +++ b/apps/tup-cms/src/apps/portal/apps.py @@ -4,6 +4,7 @@ from django.dispatch import receiver from djangocms_forms.signals import form_submission from django.conf import settings +from django.core.mail import send_mail logger = logging.getLogger(f"portal.{__name__}") @@ -42,10 +43,31 @@ def submit_ticket(form_data): requests.post(f"{service_url}/tickets/noauth", data=ticket_data, files=[]) +def send_confirmation_email(form_name, form_data): + email_body = """ +

Hello,

+

+ Thank you for submitting a form on the TACC website. +

+

+ We will act on your request according to the information provided on the form webpage. +

+ - TACC + """ + send_mail( + f"TACC Form Submission Received: {form_name}", + email_body, + "no-reply@tacc.utexas.edu", + [form_data["email"]], + html_message=email_body) + + def callback(form, cleaned_data, **kwargs): logger.debug(f"received submission from {form.name}") if form.name == 'rt-ticket-form': submit_ticket(cleaned_data) + else: + send_confirmation_email(form.name, cleaned_data) class PortalConfig(AppConfig): diff --git a/apps/tup-cms/src/taccsite_cms/settings_custom.py b/apps/tup-cms/src/taccsite_cms/settings_custom.py index b5c136956..20b799490 100644 --- a/apps/tup-cms/src/taccsite_cms/settings_custom.py +++ b/apps/tup-cms/src/taccsite_cms/settings_custom.py @@ -32,6 +32,9 @@ } } +EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +EMAIL_HOST = "relay.tacc.utexas.edu" + SESSION_COOKIE_AGE = 14400 CMS_TEMPLATES = (