-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gérer l'accès aux pages privées (#216)
* Manage access to restricted pages * Update set_config command
- Loading branch information
Showing
11 changed files
with
173 additions
and
12 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
content_manager/templates/content_manager/blocks/page_visibility.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 %} | ||
<button class="fr-icon-eye-off-line fr-btn fr-btn--tertiary-no-outline" | ||
type="button" | ||
id="cmsfr-page-visibility-btn" | ||
aria-describedby="cmsfr-page-visibility">{{ page_visibility }}</button> | ||
<span class="fr-tooltip fr-placement" | ||
id="cmsfr-page-visibility" | ||
role="tooltip" | ||
aria-hidden="true">{{ page_visibility }}</span> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
content_manager/templates/content_manager/password_required.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{% extends "base.html" %} | ||
{% load widget_tweaks i18n static dsfr_tags %} | ||
|
||
{% block title %} | ||
<title>{% translate "Password required" %} — {{ settings.content_manager.CmsDsfrConfig.site_title }}</title> | ||
{% endblock title %} | ||
|
||
{% block content %} | ||
<div class="fr-container fr-container--fluid fr-my-md-14v"> | ||
<div class="fr-grid-row fr-grid-row-gutters fr-grid-row--center"> | ||
<div class="fr-col-12 fr-col-md-8 fr-col-lg-6"> | ||
<div class="fr-container fr-background-alt--grey fr-px-md-0 fr-py-10v fr-py-md-14v"> | ||
<div class="fr-grid-row fr-grid-row-gutters fr-grid-row--center"> | ||
<div class="fr-col-12 fr-col-md-9 fr-col-lg-8"> | ||
<h1>{% translate "Password required" %}</h1> | ||
|
||
<form action="{{ action_url }}" method="post"> | ||
<fieldset class="fr-fieldset" | ||
id="login-form-fieldset" | ||
aria-labelledby="login-form-fieldset-legend login-form-fieldset-messages"> | ||
<legend class="fr-fieldset__legend" id="login-form-fieldset-legend"> | ||
<h2> | ||
{% block password_required_message %} | ||
<p>{% translate "You need a password to access this page." %}</p> | ||
{% endblock password_required_message %} | ||
</h2> | ||
</legend> | ||
|
||
{% csrf_token %} | ||
|
||
{{ form.non_field_errors }} | ||
|
||
<div class="fr-fieldset__element"> | ||
<div class="fr-password{% if form.password.errors %} fr-input-group--error{% endif %}"> | ||
<label class="fr-label" for="id_password">{% translate "Password:" %}</label> | ||
{% if form.password.errors %} | ||
{{ form.password |add_class:"fr-password__input fr-input fr-input--error" }} | ||
{% else %} | ||
{{ form.password |add_class:"fr-password__input fr-input" }} | ||
{% endif %} | ||
<div class="fr-password__checkbox fr-checkbox-group fr-checkbox-group--sm"> | ||
{% translate "Show password" as show_password %} | ||
<input aria-label="{{ show_password }}" | ||
id="id_password-show" | ||
type="checkbox" | ||
aria-describedby="id_password-show-messages"> | ||
<label class="fr-password__checkbox fr-label" for="id_password-show">{% translate "Show" %}</label> | ||
<div class="fr-messages-group" | ||
id="id_password-show-messages" | ||
aria-live="assertive"></div> | ||
</div> | ||
{% if form.password.errors %} | ||
<div id="text-input-error-desc-error" class="fr-error-text">{{ form.password.errors }}</div> | ||
{% endif %} | ||
</div> | ||
</div> | ||
|
||
{% for field in form.hidden_fields %}{{ field }}{% endfor %} | ||
|
||
<div class="fr-fieldset__element"> | ||
<ul class="fr-btns-group"> | ||
<li> | ||
{% translate "Continue" as continue_label %} | ||
<input class="fr-btn" type="submit" value="{{ continue_label }}" /> | ||
</li> | ||
</ul> | ||
</div> | ||
</fieldset> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock content %} |