diff --git a/blog/locale/fr/LC_MESSAGES/django.mo b/blog/locale/fr/LC_MESSAGES/django.mo
index bdc1c31a..9efe6853 100644
Binary files a/blog/locale/fr/LC_MESSAGES/django.mo and b/blog/locale/fr/LC_MESSAGES/django.mo differ
diff --git a/blog/locale/fr/LC_MESSAGES/django.po b/blog/locale/fr/LC_MESSAGES/django.po
index 645b011d..18255ea5 100644
--- a/blog/locale/fr/LC_MESSAGES/django.po
+++ b/blog/locale/fr/LC_MESSAGES/django.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-09-10 18:18+0200\n"
-"PO-Revision-Date: 2024-09-10 18:18+0200\n"
+"POT-Creation-Date: 2024-09-17 12:04+0200\n"
+"PO-Revision-Date: 2024-09-17 12:04+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@@ -87,19 +87,19 @@ msgstr "Catégories"
msgid "Posts per page"
msgstr "Articles par page"
-#: blog/models.py:203 blog/templates/blog/blog_index_page.html:76
+#: blog/models.py:203 blog/templates/blog/blog_index_page.html:77
msgid "Filter by category"
msgstr "Filtrer par catégorie"
-#: blog/models.py:204 blog/templates/blog/blog_index_page.html:93
+#: blog/models.py:204 blog/templates/blog/blog_index_page.html:94
msgid "Filter by tag"
msgstr "Filtrer par étiquette"
-#: blog/models.py:205 blog/templates/blog/blog_index_page.html:110
+#: blog/models.py:205 blog/templates/blog/blog_index_page.html:111
msgid "Filter by author"
msgstr "Filtrer par auteur"
-#: blog/models.py:207 blog/templates/blog/blog_index_page.html:125
+#: blog/models.py:207 blog/templates/blog/blog_index_page.html:126
msgid "Filter by source"
msgstr "Filtrer par source"
@@ -167,8 +167,8 @@ msgstr "Aucun article trouvé."
msgid "Posted by:"
msgstr "Écrit par :"
-#: blog/templates/blog/blog_index_page.html:71
-#: blog/templates/blog/blog_index_page.html:73
+#: blog/templates/blog/blog_index_page.html:72
+#: blog/templates/blog/blog_index_page.html:74
msgid "Filters"
msgstr "Filtres"
diff --git a/blog/templates/blog/blog_index_page.html b/blog/templates/blog/blog_index_page.html
index 30443a27..ec187e8f 100644
--- a/blog/templates/blog/blog_index_page.html
+++ b/blog/templates/blog/blog_index_page.html
@@ -51,6 +51,7 @@
{{ page.title }}
{% if extra_title %}: {{ extra_title }}{% endif %}
+ {% include "content_manager/blocks/page_visibility.html" %}
{% endif %}
diff --git a/config/settings.py b/config/settings.py
index 7963c091..7ec97745 100644
--- a/config/settings.py
+++ b/config/settings.py
@@ -273,6 +273,9 @@ def show_toolbar(request):
WAGTAILADMIN_PATH = os.getenv("WAGTAILADMIN_PATH", "cms-admin/")
+WAGTAIL_FRONTEND_LOGIN_URL = LOGIN_URL = f"/{WAGTAILADMIN_PATH}login/"
+WAGTAIL_PASSWORD_REQUIRED_TEMPLATE = "content_manager/password_required.html"
+
# Disable Gravatar service
WAGTAIL_GRAVATAR_PROVIDER_URL = None
diff --git a/content_manager/locale/fr/LC_MESSAGES/django.mo b/content_manager/locale/fr/LC_MESSAGES/django.mo
index af403e83..54f287c3 100644
Binary files a/content_manager/locale/fr/LC_MESSAGES/django.mo and b/content_manager/locale/fr/LC_MESSAGES/django.mo differ
diff --git a/content_manager/locale/fr/LC_MESSAGES/django.po b/content_manager/locale/fr/LC_MESSAGES/django.po
index 7fd7ad82..c8f0c1f6 100644
--- a/content_manager/locale/fr/LC_MESSAGES/django.po
+++ b/content_manager/locale/fr/LC_MESSAGES/django.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-09-10 18:18+0200\n"
-"PO-Revision-Date: 2024-09-10 18:18+0200\n"
+"POT-Creation-Date: 2024-09-17 12:04+0200\n"
+"PO-Revision-Date: 2024-09-17 12:06+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@@ -1255,6 +1255,22 @@ msgstr "Dans cette rubrique"
msgid "Go to page"
msgstr "Aller à la page"
+#: content_manager/templates/content_manager/blocks/page_visibility.html:4
+msgid "Page visibility restricted to logged in users only"
+msgstr "Visibilité de la page restreinte aux utilisateurs connectés"
+
+#: content_manager/templates/content_manager/blocks/page_visibility.html:6
+msgid "Page visibility restricted by group"
+msgstr "Visibilité de la page restreinte par groupe"
+
+#: content_manager/templates/content_manager/blocks/page_visibility.html:8
+msgid "Page visibility restricted by password"
+msgstr "Visibilité de la page restreinte par mot de passe"
+
+#: content_manager/templates/content_manager/blocks/page_visibility.html:10
+msgid "Page with restricted visibility"
+msgstr "Visibilité de la page restreinte"
+
#: content_manager/templates/content_manager/blocks/tabs.html:3
msgid "Tabs group"
msgstr "Groupe d’onglets"
@@ -1263,6 +1279,31 @@ msgstr "Groupe d’onglets"
msgid "Watch on the site"
msgstr "Voir sur le site"
+#: content_manager/templates/content_manager/password_required.html:5
+#: content_manager/templates/content_manager/password_required.html:15
+msgid "Password required"
+msgstr "Mot de passe requis"
+
+#: content_manager/templates/content_manager/password_required.html:24
+msgid "You need a password to access this page."
+msgstr "L’accès à cette page nécessite un mot de passe."
+
+#: content_manager/templates/content_manager/password_required.html:35
+msgid "Password:"
+msgstr "Mot de passe :"
+
+#: content_manager/templates/content_manager/password_required.html:42
+msgid "Show password"
+msgstr "Afficher le mot de passe"
+
+#: content_manager/templates/content_manager/password_required.html:47
+msgid "Show"
+msgstr "Afficher"
+
+#: content_manager/templates/content_manager/password_required.html:63
+msgid "Continue"
+msgstr "Continuer"
+
#: content_manager/templates/content_manager/tags_list_page.html:31
#: content_manager/views.py:46 content_manager/views.py:77
msgid "Tags"
diff --git a/content_manager/management/commands/set_config.py b/content_manager/management/commands/set_config.py
index f51d6a2c..d06a5309 100644
--- a/content_manager/management/commands/set_config.py
+++ b/content_manager/management/commands/set_config.py
@@ -3,7 +3,7 @@
from django.conf import settings
from django.core.management.base import BaseCommand
-from wagtail.models import Site
+from wagtail.models import Group, Site
from content_manager.models import CmsDsfrConfig
@@ -14,6 +14,8 @@ def handle(self, *args, **kwargs):
Sets the site hostname and site_name,
and imports contents from the config.json file if present.
"""
+
+ # Set the site hostname and site_name
if "http://" in settings.HOST_URL or "https://" in settings.HOST_URL:
raise ValueError(
"""The HOST_URL environment variable must contain the domain name only,
@@ -25,6 +27,18 @@ def handle(self, *args, **kwargs):
site.site_name = settings.WAGTAIL_SITE_NAME
site.save()
+ # Translate the names of the default user groups.
+ mods_group = Group.objects.filter(name="Moderators").first()
+ if mods_group:
+ mods_group.name = "Modérateurs"
+ mods_group.save()
+
+ editors_group = Group.objects.filter(name="Editors").first()
+ if editors_group:
+ editors_group.name = "Éditeurs"
+ editors_group.save()
+
+ # Import config.json
if isfile("config.json"):
with open("config.json") as config_file:
config_data = json.load(config_file)
diff --git a/content_manager/templates/content_manager/blocks/heading.html b/content_manager/templates/content_manager/blocks/heading.html
index 8624f223..ed2361bd 100644
--- a/content_manager/templates/content_manager/blocks/heading.html
+++ b/content_manager/templates/content_manager/blocks/heading.html
@@ -13,6 +13,7 @@
{{ page.title }}
{% if extra_title %}: {{ extra_title }}{% endif %}
+ {% include "content_manager/blocks/page_visibility.html" %}
{% endif %}
{% if page.header_cta_text %}{{ page.header_cta_text|richtext }}{% endif %}
diff --git a/content_manager/templates/content_manager/blocks/page_visibility.html b/content_manager/templates/content_manager/blocks/page_visibility.html
new file mode 100644
index 00000000..ad7df1c3
--- /dev/null
+++ b/content_manager/templates/content_manager/blocks/page_visibility.html
@@ -0,0 +1,20 @@
+{% load i18n %}
+{% if page.get_view_restrictions %}
+ {% if page.get_view_restrictions.first.restriction_type == "login" %}
+ {% translate "Page visibility restricted to logged in users only" as page_visibility %}
+ {% elif page.get_view_restrictions.first.restriction_type == "groups" %}
+ {% translate "Page visibility restricted by group" as page_visibility %}
+ {% elif page.get_view_restrictions.first.restriction_type == "password" %}
+ {% translate "Page visibility restricted by password" as page_visibility %}
+ {% else %}
+ {% translate "Page with restricted visibility" as page_visibility %}
+ {% endif %}
+
+ {{ page_visibility }}
+{% endif %}
diff --git a/content_manager/templates/content_manager/content_page.html b/content_manager/templates/content_manager/content_page.html
index bb931a0f..d5881280 100644
--- a/content_manager/templates/content_manager/content_page.html
+++ b/content_manager/templates/content_manager/content_page.html
@@ -44,7 +44,12 @@
{% include "content_manager/blocks/heading.html" %}
{% include "content_manager/blocks/breadcrumbs.html" %}
- {% if not page.header_with_title %}
{{ page.title }}
{% endif %}
+ {% if not page.header_with_title %}
+
+ {{ page.title }}
+ {% include "content_manager/blocks/page_visibility.html" %}
+
+ {% endif %}
{% include "content_manager/blocks/messages.html" %}
diff --git a/content_manager/templates/content_manager/password_required.html b/content_manager/templates/content_manager/password_required.html
new file mode 100644
index 00000000..600ca0cb
--- /dev/null
+++ b/content_manager/templates/content_manager/password_required.html
@@ -0,0 +1,76 @@
+{% extends "base.html" %}
+{% load widget_tweaks i18n static dsfr_tags %}
+
+{% block title %}
+ {% translate "Password required" %} — {{ settings.content_manager.CmsDsfrConfig.site_title }}
+{% endblock title %}
+
+{% block content %}
+
+
+
+
+
+
+
{% translate "Password required" %}
+
+
+
+
+
+
+
+
+{% endblock content %}