Skip to content

Commit

Permalink
CMD-140: Make Core-CMS Confirmation E-mail Opt-In Setting (#827)
Browse files Browse the repository at this point in the history
* CMD-140: Make Core-CMS Confirmation E-mail Opt-In Setting

* remove assets, because that will be added in a different pr

* Add setting to email_management app

* Allow setting to send conf email or not

* use better naming conventions.

* refactor: move new setting

---------

Co-authored-by: Wesley Bomar <wbomar@tacc.utexas.edu>
  • Loading branch information
R-Tomas-Gonzalez and wesleyboar authored Mar 29, 2024
1 parent 2c745ca commit ad38f22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/email_management/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import logging
from djangocms_forms.signals import form_submission
from django.core.mail import send_mail
from django.conf import settings

PORTAL_SHOULD_SEND_CONF_EMAIL = settings.PORTAL_SHOULD_SEND_CONF_EMAIL

logger = logging.getLogger(f"portal.{__name__}")

Expand Down Expand Up @@ -44,7 +47,7 @@ def send_confirmation_email(form_name, form_data):
def callback(form, cleaned_data, **kwargs):
logger.debug(f"received submission from {form.name}")
logger.debug(type(cleaned_data))
if ('email' in cleaned_data):
if ('email' in cleaned_data and PORTAL_SHOULD_SEND_CONF_EMAIL):
send_confirmation_email(form.name, cleaned_data)

class EmailManagementConfig(AppConfig):
Expand Down
6 changes: 6 additions & 0 deletions taccsite_cms/_settings/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@
# EMAIL_HOST = 'localhost'
# EMAIL_PORT = 1025
# DEFAULT_FROM_EMAIL = 'no-reply@localhost'

########################
# TACC: EMAIL
########################

PORTAL_SHOULD_SEND_CONF_EMAIL = False

0 comments on commit ad38f22

Please sign in to comment.