Skip to content

Commit

Permalink
setup nonce value in template containing scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Jun 12, 2023
1 parent 0e669a2 commit 20fc7cd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
{% endif %}


<script>
<script nonce="{{ request.csp_nonce }}">
function DisabledMe(id) {
document.getElementById(id).classList.add('disabled');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
{% endwith %}
</div>

<script>
<script nonce="{{ request.csp_nonce }}">
document.activeElement?.blur();
</script>
4 changes: 2 additions & 2 deletions lacommunaute/templates/layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
{% block js %}
{% import_static_JS_theme_inclusion %}
<script src="{% static 'machina/build/js/machina.min.js' %}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
<script type="text/javascript" nonce="{{ request.csp_nonce }}">
$(function() {
machina.init();
{% block onbodyload %}{% endblock onbodyload %}
Expand All @@ -115,7 +115,7 @@

{% block extra_js %}
<script src="{% static "vendor/tarteaucitron.js-1.11.0/tarteaucitron.js" %}"></script>
<script>
<script nonce="{{ request.csp_nonce }}">
// Tarteaucitron's language is set according to the browser configuration
// but a lot of users don't know how to change it.
// This can be forced only by using a global `var` statement.
Expand Down
2 changes: 1 addition & 1 deletion lacommunaute/templates/pages/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ <h2 class="h1 mb-3 mb-lg-5">Améliorez votre pratique professionnelle :</h2>
{% block extra_js %}
{{ block.super }}
<script async src="https://tally.so/widgets/embed.js"></script>
<script defer>
<script defer nonce="{{ request.csp_nonce }}">
// Any given Tally popup will not be shown more than once every `minDaysBetweenDisplays` days.
const minDaysBetweenDisplays = 14;
const delayBeforeShowingPopupInSeconds = 45;
Expand Down

0 comments on commit 20fc7cd

Please sign in to comment.