Skip to content

Commit

Permalink
Fix #65 Add Django tags for security to update & delete_recipe templates
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-townsend committed Jan 26, 2023
1 parent e33e522 commit f4c2eb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion templates/delete_recipe.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
{% load cloudinary %}
{% load crispy_forms_tags %}

<!-- This page allows a user to delete their own recipe -->
{% if user.is_authenticated and user.id == recipe.author.id %}

<!-- This page allows a user to delete their recipe if they are the recipe author -->
<div class="container">
<h1 class="page-title">Delete Recipe</h1>
<hr>
Expand All @@ -28,4 +30,10 @@ <h5 class="text-center"><strong>Are you sure you want to delete your {{ recipe.t
</div>
</div>

{% elif user.is_authenticated %}

{% include "403.html" %}

{% endif %}

{% endblock %}
10 changes: 8 additions & 2 deletions templates/update_recipe.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
{% load cloudinary %}
{% load crispy_forms_tags %}

{% if user.is_authenticated and user.id == recipe.author.id %}

<!-- This page allows a user to update their own recipe -->
<!-- This page allows a user to update their recipe if they are the recipe author -->
<div class="container">
<h1 class="page-title">Update Recipe</h1>
<hr>
Expand All @@ -25,5 +26,10 @@ <h1 class="page-title">Update Recipe</h1>
</div>
</div>

{% elif user.is_authenticated %}

{% endblock content %}
{% include "403.html" %}

{% endif %}

{% endblock %}

0 comments on commit f4c2eb8

Please sign in to comment.