From d3682368b4a3cd9f67a398c9108385482dcd2ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sun, 8 Jan 2023 15:23:04 +0100 Subject: [PATCH 1/2] Fix CSRF error --- Dockerfile | 4 ++-- src/web/web/settings.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3439f94..081552c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN npm install && \ FROM python:3.10.9-alpine -ENV VERSION_NUMBER 0.1.2 +ENV VERSION_NUMBER 0.1.0-59-gc9b2d5b ENV PROD 1 RUN apk add \ @@ -28,4 +28,4 @@ RUN pip install --no-cache-dir poetry RUN poetry install --without dev EXPOSE 8000 -ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file +CMD [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/src/web/web/settings.py b/src/web/web/settings.py index 2010421..a0ca0ac 100644 --- a/src/web/web/settings.py +++ b/src/web/web/settings.py @@ -145,7 +145,8 @@ LOGGING = { }, } -CSRF_TRUSTED_ORIGINS = [] - -if os.environ.get("PROD"): - CSRF_TRUSTED_ORIGINS.append(os.environ.get("CSRF_TRUSTED_ORIGINS")) +_csrf_trusted_origins = os.environ.get("CSRF_TRUSTED_ORIGINS") +if _csrf_trusted_origins: + CSRF_TRUSTED_ORIGINS = _csrf_trusted_origins.split(",") +else: + CSRF_TRUSTED_ORIGINS = [] -- 2.40.1 From 83f075e49d5bfe889c96bd30c7ba42f8b15f6dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sun, 8 Jan 2023 15:30:28 +0100 Subject: [PATCH 2/2] Update version, changelog --- CHANGELOG.md | 4 ++++ Dockerfile | 4 ++-- pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f71930a..a8f1516 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.3 / 2023-01-08 15:23+01:00 + +* Fix CSRF error (https://git.kucharczyk.xyz/lukas/timetracker/pulls/22) + ## 0.1.2 / 2023-01-07 22:05+01:00 * Switch to Uvicorn/Gunicorn + Caddy (https://git.kucharczyk.xyz/lukas/timetracker/pulls/4) diff --git a/Dockerfile b/Dockerfile index 081552c..8aa0b50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN npm install && \ FROM python:3.10.9-alpine -ENV VERSION_NUMBER 0.1.0-59-gc9b2d5b +ENV VERSION_NUMBER 0.1.3 ENV PROD 1 RUN apk add \ @@ -28,4 +28,4 @@ RUN pip install --no-cache-dir poetry RUN poetry install --without dev EXPOSE 8000 -CMD [ "/entrypoint.sh" ] \ No newline at end of file +ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 55795fa..0e7cd4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "timetracker" -version = "0.1.2" +version = "0.1.3" description = "A simple time tracker." authors = ["Lukáš Kucharczyk "] license = "GPL" -- 2.40.1