From 3743a08996928c3aa30dcf10d49aaf70a568d5d9 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 30 Dec 2021 09:47:36 +0100 Subject: [PATCH 1/5] marked required env fields --- .env.template | 4 ++++ docs/install/docker.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.env.template b/.env.template index 36c2357d5..635e079c9 100644 --- a/.env.template +++ b/.env.template @@ -7,7 +7,9 @@ SQL_DEBUG=0 ALLOWED_HOSTS=* # random secret key, use for example `base64 /dev/urandom | head -c50` to generate one +# ---------------------------- REQUIRED ------------------------- SECRET_KEY= +# --------------------------------------------------------------- # your default timezone See https://timezonedb.com/time-zones for a list of timezones TIMEZONE=Europe/Berlin @@ -18,7 +20,9 @@ DB_ENGINE=django.db.backends.postgresql POSTGRES_HOST=db_recipes POSTGRES_PORT=5432 POSTGRES_USER=djangouser +# ---------------------------- REQUIRED ------------------------- POSTGRES_PASSWORD= +# --------------------------------------------------------------- POSTGRES_DB=djangodb # database connection string, when used overrides other database settings. diff --git a/docs/install/docker.md b/docs/install/docker.md index 23fc02a41..4b572c432 100644 --- a/docs/install/docker.md +++ b/docs/install/docker.md @@ -51,7 +51,7 @@ There are different versions (tags) released on docker hub. The main, and also recommended, installation option is to install this application using Docker Compose. 1. Choose your `docker-compose.yml` from the examples below. -2. Download the `.env` configuration file with `wget`, then **edit it accordingly**. +2. Download the `.env` configuration file with `wget`, then **edit it accordingly** (you NEED to set `SECRET_KEY` and `POSTGRES_PASSWORD`). ```shell wget https://raw.githubusercontent.com/vabene1111/recipes/develop/.env.template -O .env ``` From bddaa77f718396dadfaecfef9c2a215992970594 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 30 Dec 2021 17:37:10 +0100 Subject: [PATCH 2/5] fixed space not honourd in invite link --- cookbook/admin.py | 2 +- cookbook/views/new.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cookbook/admin.py b/cookbook/admin.py index 4c4fc5220..0a03093dc 100644 --- a/cookbook/admin.py +++ b/cookbook/admin.py @@ -257,7 +257,7 @@ admin.site.register(ViewLog, ViewLogAdmin) class InviteLinkAdmin(admin.ModelAdmin): list_display = ( - 'group', 'valid_until', + 'group', 'valid_until','space', 'created_by', 'created_at', 'used_by' ) diff --git a/cookbook/views/new.py b/cookbook/views/new.py index 09949be2f..382ba2ab1 100644 --- a/cookbook/views/new.py +++ b/cookbook/views/new.py @@ -201,7 +201,10 @@ class InviteLinkCreate(GroupRequiredMixin, CreateView): def form_valid(self, form): obj = form.save(commit=False) obj.created_by = self.request.user - obj.space = self.request.space + + # verify given space is actually owned by the user creating the link + if obj.space.created_by != self.request.user: + obj.space = self.request.space obj.save() if obj.email: try: From 2e69a00fce418e706f6dc11de1c29a9e72509220 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 30 Dec 2021 17:57:04 +0100 Subject: [PATCH 3/5] improved recipe edit input validation --- cookbook/admin.py | 2 +- vue/src/apps/RecipeEditView/RecipeEditView.vue | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cookbook/admin.py b/cookbook/admin.py index 0a03093dc..e53a27a86 100644 --- a/cookbook/admin.py +++ b/cookbook/admin.py @@ -257,7 +257,7 @@ admin.site.register(ViewLog, ViewLogAdmin) class InviteLinkAdmin(admin.ModelAdmin): list_display = ( - 'group', 'valid_until','space', + 'group', 'valid_until', 'space', 'created_by', 'created_at', 'used_by' ) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 61cad5e0b..9b38fd1ce 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -49,13 +49,13 @@
- +
- +
- +
@@ -343,7 +343,7 @@
- @@ -623,9 +623,10 @@ export default { this.sortIngredients(s) } - if (this.recipe.waiting_time === ''){ this.recipe.waiting_time = 0} - if (this.recipe.working_time === ''){ this.recipe.working_time = 0} - if (this.recipe.servings === ''){ this.recipe.servings = 0} + if (this.recipe.waiting_time === '' || isNaN(this.recipe.waiting_time)){ this.recipe.waiting_time = 0} + if (this.recipe.working_time === ''|| isNaN(this.recipe.working_time)){ this.recipe.working_time = 0} + if (this.recipe.servings === ''|| isNaN(this.recipe.servings)){ this.recipe.servings = 0} + apiFactory.updateRecipe(this.recipe_id, this.recipe, {}).then((response) => { From f21587605a070c387b4ff90b599f1bdadff093e2 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 30 Dec 2021 18:03:08 +0100 Subject: [PATCH 4/5] fixed sub recipe rendering --- vue/src/components/StepComponent.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vue/src/components/StepComponent.vue b/vue/src/components/StepComponent.vue index 403b58299..cf58bb27c 100644 --- a/vue/src/components/StepComponent.vue +++ b/vue/src/components/StepComponent.vue @@ -112,8 +112,8 @@ {{ step.step_recipe_data.name }}
- +
From c50a89c651ae7781ba3f2176dfa6f22262211aa0 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 30 Dec 2021 18:08:29 +0100 Subject: [PATCH 5/5] disabled tree fix at startup for now --- cookbook/apps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/apps.py b/cookbook/apps.py index 3297d6928..5b2777f2b 100644 --- a/cookbook/apps.py +++ b/cookbook/apps.py @@ -24,8 +24,8 @@ class CookbookConfig(AppConfig): with scopes_disabled(): try: from cookbook.models import Keyword, Food - Keyword.fix_tree(fix_paths=True) - Food.fix_tree(fix_paths=True) + #Keyword.fix_tree(fix_paths=True) # disabled for now, causes to many unknown issues + #Food.fix_tree(fix_paths=True) except OperationalError: if DEBUG: traceback.print_exc()