From 18cd10f982c7671697dbff48456c6283bbea7022 Mon Sep 17 00:00:00 2001 From: Rechner Fox <659028+rechner@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:12:22 -0800 Subject: [PATCH] Set all .ajax() calls content type, tweak logging * Verbose logging output * Include email in ban-list alert --- fm_eventmanager/settings.py.docker | 17 ++++++++++++++++- .../templates/registration/attendee-locate.html | 1 + .../registration/attendee-upgrade.html | 1 + .../templates/registration/checkout.html | 2 ++ .../templates/registration/onsite-checkout.html | 2 ++ registration/templates/registration/onsite.html | 1 + .../registration/registration-form.html | 1 + registration/views/cart.py | 2 +- 8 files changed, 25 insertions(+), 2 deletions(-) diff --git a/fm_eventmanager/settings.py.docker b/fm_eventmanager/settings.py.docker index 5148a260..7e685791 100644 --- a/fm_eventmanager/settings.py.docker +++ b/fm_eventmanager/settings.py.docker @@ -63,6 +63,16 @@ DEBUG = os.getenv('DJANGO_DEBUG', False) LOGGING = { 'version': 1, 'disable_existing_loggers': False, + 'formatters': { + 'verbose': { + 'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}', + 'style': '{', + }, + 'simple': { + 'format': '{levelname} {message}', + 'style': '{', + }, + }, 'filters': { 'require_debug_true': { '()': 'django.utils.log.RequireDebugTrue', @@ -71,8 +81,9 @@ LOGGING = { 'handlers': { 'console': { 'level': 'INFO', - 'filters': ['require_debug_true'], + #'filters': ['require_debug_true'], 'class': 'logging.StreamHandler', + 'formatter': 'verbose', }, }, 'loggers': { @@ -80,6 +91,10 @@ LOGGING = { 'handlers': ['console'], 'level': 'DEBUG', }, + 'django': { + 'handlers': ['console'], + 'propagate': True, + }, }, } diff --git a/registration/templates/registration/attendee-locate.html b/registration/templates/registration/attendee-locate.html index f8246333..a49ffc93 100644 --- a/registration/templates/registration/attendee-locate.html +++ b/registration/templates/registration/attendee-locate.html @@ -73,6 +73,7 @@

Registration Upgrade - {{ event }}

$.ajax({ "type": "POST", "dataType": "json", + "contentType": "application/json; charset=utf-8", "url": "{% url 'registration:info_upgrade' %}", "data": JSON.stringify(data), "beforeSend": function (xhr, settings) { diff --git a/registration/templates/registration/attendee-upgrade.html b/registration/templates/registration/attendee-upgrade.html index ee2bf52d..59affc57 100644 --- a/registration/templates/registration/attendee-upgrade.html +++ b/registration/templates/registration/attendee-upgrade.html @@ -369,6 +369,7 @@

$.ajax({ "type": "POST", "dataType": "json", + "contentType": "application/json; charset=utf-8", "url": "{% url 'registration:add_upgrade' %}", "data": JSON.stringify(data), "beforeSend": function (xhr, settings) { diff --git a/registration/templates/registration/checkout.html b/registration/templates/registration/checkout.html index ec01c7f8..f7e19b7c 100644 --- a/registration/templates/registration/checkout.html +++ b/registration/templates/registration/checkout.html @@ -370,6 +370,7 @@

There are no attendees in your order

$.ajax({ "type": "POST", "dataType": "json", + "contentType": "application/json; charset=utf-8", "url": URL_REGISTRATION_REMOVE_FROM_CART, "data": JSON.stringify(data), "beforeSend": function (xhr, settings) { @@ -414,6 +415,7 @@

There are no attendees in your order

$.ajax({ "type": "POST", "dataType": "json", + "contentType": "application/json; charset=utf-8", "url": URL_REGISTRATION_DISCOUNT, "data": JSON.stringify(data), "beforeSend": function (xhr, settings) { diff --git a/registration/templates/registration/onsite-checkout.html b/registration/templates/registration/onsite-checkout.html index a0aae4f0..6fe4bff7 100644 --- a/registration/templates/registration/onsite-checkout.html +++ b/registration/templates/registration/onsite-checkout.html @@ -141,6 +141,7 @@

There are no attendees in your order

$.ajax({ "type": "POST", "dataType": "json", + "contentType": "application/json; charset=utf-8", "url": "{% url 'registration:remove_from_cart' %}", "data": JSON.stringify(data), "beforeSend": function (xhr, settings) { @@ -196,6 +197,7 @@

There are no attendees in your order

$.ajax({ "type": "POST", "dataType": "json", + "contentType": "application/json; charset=utf-8", "url": "{% url 'registration:checkout' %}", "data": JSON.stringify(data), "beforeSend": function (xhr, settings) { diff --git a/registration/templates/registration/onsite.html b/registration/templates/registration/onsite.html index e516e3ae..56f21939 100644 --- a/registration/templates/registration/onsite.html +++ b/registration/templates/registration/onsite.html @@ -530,6 +530,7 @@

$.ajax({ "type": "POST", "dataType": "json", + "contentType": "application/json; charset=utf-8", "url": "{% url 'registration:add_to_cart' %}", "data": JSON.stringify(data), "beforeSend": function (xhr, settings) { diff --git a/registration/templates/registration/registration-form.html b/registration/templates/registration/registration-form.html index 6eb753eb..ea35b3c7 100644 --- a/registration/templates/registration/registration-form.html +++ b/registration/templates/registration/registration-form.html @@ -455,6 +455,7 @@

$.ajax({ "type": "POST", "dataType": "json", + "contentType": "application/json; charset=utf-8", "url": "{% url 'registration:add_to_cart' %}", "data": JSON.stringify(data), "beforeSend": function (xhr, settings) { diff --git a/registration/views/cart.py b/registration/views/cart.py index b2e16424..4fcfbe51 100644 --- a/registration/views/cart.py +++ b/registration/views/cart.py @@ -220,7 +220,7 @@ def add_to_cart(request): banCheck = check_ban_list(pda["firstName"], pda["lastName"], pda["email"]) if banCheck: - logger.error("***ban list registration attempt***") + logger.error(f"***ban list registration attempt: {pda['email']}***") registrationEmail = common.get_registration_email() return common.abort( 403,