diff --git a/app/logging_config.py b/app/logging_config.py index 311c5e9..2db09be 100644 --- a/app/logging_config.py +++ b/app/logging_config.py @@ -128,14 +128,13 @@ def configure_logging(app): app.logger.addHandler(app_handler) # ------------------------------------------------------------------------- - # 4. Console Handler (for development) + # 4. Console Handler (always enabled for debugging in both dev and production) # ------------------------------------------------------------------------- - if os.getenv('FLASK_DEBUG', 'false').lower() == 'true': - console_handler = logging.StreamHandler() - console_handler.setLevel(logging.DEBUG) - console_handler.setFormatter(formatter) - console_handler.addFilter(sensitive_filter) - app.logger.addHandler(console_handler) + console_handler = logging.StreamHandler() + console_handler.setLevel(log_level) + console_handler.setFormatter(formatter) + console_handler.addFilter(sensitive_filter) + app.logger.addHandler(console_handler) # Log startup information app.logger.info('Logging configured - Level: %s, Log directory: %s', log_level_name, log_dir) diff --git a/app/templates/layouts/base.html b/app/templates/layouts/base.html index 22676c3..8961f03 100644 --- a/app/templates/layouts/base.html +++ b/app/templates/layouts/base.html @@ -85,12 +85,6 @@ {% endif %} {% if current_user.role == 'coach' %} -
  • - - - Availability - -
  • diff --git a/app/templates/pages/coach_availability.html b/app/templates/pages/coach_availability.html index 2a1629a..549ecb5 100644 --- a/app/templates/pages/coach_availability.html +++ b/app/templates/pages/coach_availability.html @@ -15,6 +15,9 @@
    + @@ -168,13 +171,18 @@ function saveAvailability() { fetch('{{ url_for("users.manage_coach_availability") }}', { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: { + 'Content-Type': 'application/json', + 'X-CSRFToken': '{{ csrf_token() }}' + }, body: JSON.stringify({ slots: slots }) }) .then(response => response.json()) .then(data => { if (data.success) { flash('Availability saved!', 'success'); + } else { + flash(data.error || 'Error saving availability.', 'danger'); } }) .catch(function(error) { @@ -188,7 +196,10 @@ function clearAllAvailability() { return; } - fetch('{{ url_for("users.clear_coach_availability") }}', { method: 'POST' }) + fetch('{{ url_for("users.clear_coach_availability") }}', { + method: 'POST', + headers: { 'X-CSRFToken': '{{ csrf_token() }}' } + }) .then(response => response.json()) .then(data => { if (data.success) { diff --git a/app/templates/pages/profile.html b/app/templates/pages/profile.html index 5e859ef..3f52c2c 100644 --- a/app/templates/pages/profile.html +++ b/app/templates/pages/profile.html @@ -357,7 +357,10 @@ function saveCoachAvailability() { } fetch('{{ url_for("users.manage_coach_availability") }}', { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: { + 'Content-Type': 'application/json', + 'X-CSRFToken': '{{ csrf_token() }}' + }, body: JSON.stringify({ slots: slots }) }) .then(r => r.json()) @@ -376,7 +379,10 @@ function saveCoachAvailability() { function clearAllAvailability() { if (!confirm('Are you sure you want to clear all your availability slots?')) return; - fetch('{{ url_for("users.clear_coach_availability") }}', { method: 'POST' }) + fetch('{{ url_for("users.clear_coach_availability") }}', { + method: 'POST', + headers: { 'X-CSRFToken': '{{ csrf_token() }}' } + }) .then(r => r.json()) .then(data => { if (data.success) { diff --git a/app/supporting_scripts/run_https.py b/run_https.py similarity index 100% rename from app/supporting_scripts/run_https.py rename to run_https.py