From fe31d8cfda5b17ea5467579f80dd7eed094a3df3 Mon Sep 17 00:00:00 2001 From: Julien Constant Date: Sun, 12 Mar 2023 14:06:42 +0100 Subject: [PATCH] Fix SAS being accessible for non-connected users (wtf) --- locale/fr/LC_MESSAGES/django.po | 4 ++ sas/templates/sas/main.jinja | 114 +++++++++++++++++--------------- 2 files changed, 64 insertions(+), 54 deletions(-) diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 76ef05fb..6017b925 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -5301,6 +5301,10 @@ msgstr "Cet album ne contient aucune photo." msgid "preview" msgstr "miniature" +#: sas/templates/sas/main.jinja:42 +msgid "You must be logged in to see the SAS." +msgstr "Vous devez ĂȘtre connectĂ© pour voir les photos." + #: sas/templates/sas/album.jinja:89 msgid "Upload" msgstr "Envoyer" diff --git a/sas/templates/sas/main.jinja b/sas/templates/sas/main.jinja index c4d7bab6..cc8c6f07 100644 --- a/sas/templates/sas/main.jinja +++ b/sas/templates/sas/main.jinja @@ -37,67 +37,73 @@ {% block content %}

{% trans %}SAS{% endtrans %}

-
-

{% trans %}Latest albums{% endtrans %}

-
- {% for a in latest %} - {{ display_album(a) }} - {% endfor %} -
-
- - {% if edit_mode %} -
- {% csrf_token %} - - - - {% if clipboard %} -
- {% trans %}Clipboard: {% endtrans %} -
    - {% for f in clipboard %} -
  • {{ f.get_full_path() }}
  • - {% endfor %} -
- -
- {% endif %} + {% if not user.is_authenticated %} +

{% trans %}You must be logged in to see the SAS.{% endtrans %}

{% else %} -

{% trans %}All categories{% endtrans %}

- {% endif %} +
+

{% trans %}Latest albums{% endtrans %}

-
- {% for a in categories %} - {{ display_album(a, true) }} - {% endfor %} -
- - {% if edit_mode %} -
+
+ {% for a in latest %} + {{ display_album(a) }} + {% endfor %} +

-
- {% csrf_token %} + {% if edit_mode %} + + {% csrf_token %} -
-
- - {{ form.album_name }} + - -
- - {{ form.non_field_errors() }} - {{ form.album_name.errors }} - + + {% if clipboard %} +
+ {% trans %}Clipboard: {% endtrans %} +
    + {% for f in clipboard %} +
  • {{ f.get_full_path() }}
  • + {% endfor %} +
+ +
+ {% endif %} + {% else %} +

{% trans %}All categories{% endtrans %}

+ {% endif %} + +
+ {% for a in categories %} + {{ display_album(a, true) }} + {% endfor %} +
+ + {% if edit_mode %} + + +
+ +
+ {% csrf_token %} + +
+
+ + {{ form.album_name }} +
+ +
+ + {{ form.non_field_errors() }} + {{ form.album_name.errors }} +
+ {% endif %} {% endif %} {% endblock %}