From afb9cce2677d8e2f42a46225c183e94bbdc77501 Mon Sep 17 00:00:00 2001 From: Camille Daniel Date: Thu, 29 Jul 2021 11:50:13 +0200 Subject: [PATCH] Move flask.messages() to base.html to avoid forgotten pages and message displayed on the wrong page --- canaille/templates/about.html | 2 -- canaille/templates/admin/authorization_view.html | 3 --- canaille/templates/admin/client_add.html | 3 --- canaille/templates/admin/client_edit.html | 3 --- canaille/templates/admin/client_list.html | 3 --- canaille/templates/admin/token_view.html | 3 --- canaille/templates/base.html | 3 +++ canaille/templates/consent_list.html | 3 --- canaille/templates/firstlogin.html | 3 --- canaille/templates/forgotten-password.html | 3 --- canaille/templates/group.html | 3 --- canaille/templates/groups.html | 3 --- canaille/templates/login.html | 3 --- canaille/templates/password.html | 3 --- canaille/templates/profile.html | 3 --- canaille/templates/reset-password.html | 3 --- canaille/templates/users.html | 3 --- 17 files changed, 3 insertions(+), 47 deletions(-) diff --git a/canaille/templates/about.html b/canaille/templates/about.html index a369d4cd..d631471b 100644 --- a/canaille/templates/about.html +++ b/canaille/templates/about.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% import 'fomanticui.j2' as sui %} -{% import 'flask.j2' as flask %} {% block content %}
@@ -8,7 +7,6 @@ {{ website_name }} - {{ flask.messages() }}

{{ _("About canaille") }} diff --git a/canaille/templates/admin/authorization_view.html b/canaille/templates/admin/authorization_view.html index 11192da5..3424a132 100644 --- a/canaille/templates/admin/authorization_view.html +++ b/canaille/templates/admin/authorization_view.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% import 'fomanticui.j2' as sui %} -{% import 'flask.j2' as flask %} {% block content %}
@@ -8,8 +7,6 @@ {% trans %}View a authorization{% endtrans %}

- {{ flask.messages() }} -
    {% for attr in authorization.may %} diff --git a/canaille/templates/admin/client_add.html b/canaille/templates/admin/client_add.html index de08ce21..e628f4e2 100644 --- a/canaille/templates/admin/client_add.html +++ b/canaille/templates/admin/client_add.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% import 'fomanticui.j2' as sui %} -{% import 'flask.j2' as flask %} {% block content %}
    @@ -8,8 +7,6 @@ {% trans %}Add a client{% endtrans %} - {{ flask.messages() }} -
    {{ sui.render_form(form, _("Confirm")) }}
    diff --git a/canaille/templates/admin/client_edit.html b/canaille/templates/admin/client_edit.html index 71d18ced..9edd16e3 100644 --- a/canaille/templates/admin/client_edit.html +++ b/canaille/templates/admin/client_edit.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% import 'fomanticui.j2' as sui %} -{% import 'flask.j2' as flask %} {% block script %} @@ -26,8 +25,6 @@ {% trans %}Edit a client{% endtrans %} - {{ flask.messages() }} -
    diff --git a/canaille/templates/admin/client_list.html b/canaille/templates/admin/client_list.html index b4a61da4..0152d9a6 100644 --- a/canaille/templates/admin/client_list.html +++ b/canaille/templates/admin/client_list.html @@ -1,5 +1,4 @@ {% extends 'base.html' %} -{% import 'flask.j2' as flask %} {% block style %} @@ -14,8 +13,6 @@ {% block content %} -{{ flask.messages() }} - diff --git a/canaille/templates/admin/token_view.html b/canaille/templates/admin/token_view.html index b7d567b4..2d8980c1 100644 --- a/canaille/templates/admin/token_view.html +++ b/canaille/templates/admin/token_view.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% import 'fomanticui.j2' as sui %} -{% import 'flask.j2' as flask %} {% block content %}
    @@ -8,8 +7,6 @@ {% trans %}View a token{% endtrans %} - {{ flask.messages() }} -
      {% for attr in token.may %} diff --git a/canaille/templates/base.html b/canaille/templates/base.html index 62dd8b2c..4d8198dd 100644 --- a/canaille/templates/base.html +++ b/canaille/templates/base.html @@ -1,3 +1,5 @@ +{% import 'flask.j2' as flask %} + @@ -87,6 +89,7 @@
      + {{ flask.messages() }} {% block content %}{% endblock %}
      diff --git a/canaille/templates/consent_list.html b/canaille/templates/consent_list.html index f182b7c4..14380fd9 100644 --- a/canaille/templates/consent_list.html +++ b/canaille/templates/consent_list.html @@ -1,5 +1,4 @@ {% extends 'base.html' %} -{% import 'flask.j2' as flask %} {% block style %} @@ -23,8 +22,6 @@
    - {{ flask.messages() }} - {% if consents %}
    {% for consent in consents %} diff --git a/canaille/templates/firstlogin.html b/canaille/templates/firstlogin.html index 4c9103f3..b9cb948f 100644 --- a/canaille/templates/firstlogin.html +++ b/canaille/templates/firstlogin.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% import 'fomanticui.j2' as sui %} -{% import 'flask.j2' as flask %} {% block content %}
    @@ -13,8 +12,6 @@
    - {{ flask.messages() }} -
    {% trans %} It seems this is the first time you are logging here. In order to finalize your diff --git a/canaille/templates/forgotten-password.html b/canaille/templates/forgotten-password.html index 436f2bfb..d2abfaca 100644 --- a/canaille/templates/forgotten-password.html +++ b/canaille/templates/forgotten-password.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% import 'fomanticui.j2' as sui %} -{% import 'flask.j2' as flask %} {% block content %}
    @@ -13,8 +12,6 @@
    - {{ flask.messages() }} -
    {% trans %} After this form is sent, if the email address or the login you provided diff --git a/canaille/templates/group.html b/canaille/templates/group.html index 20602c42..a5973597 100644 --- a/canaille/templates/group.html +++ b/canaille/templates/group.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% import 'fomanticui.j2' as sui %} -{% import 'flask.j2' as flask %} {% block script %} @@ -58,8 +57,6 @@
    - {{ flask.messages() }} - {% trans %}Add a group{% endtrans %}
    diff --git a/canaille/templates/login.html b/canaille/templates/login.html index 6fec377d..f3ad64c3 100644 --- a/canaille/templates/login.html +++ b/canaille/templates/login.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% import 'fomanticui.j2' as sui %} -{% import 'flask.j2' as flask %} {% block content %}
    @@ -19,8 +18,6 @@
    {% trans %}Log-in and manage your authorizations.{% endtrans %}
    - {{ flask.messages() }} - @@ -19,8 +18,6 @@
    {% trans %}Please enter your password for this account.{% endtrans %}
    - {{ flask.messages() }} - @@ -52,8 +51,6 @@
    - {{ flask.messages() }} - @@ -13,8 +12,6 @@
    - {{ flask.messages() }} -
    {{ sui.render_form(form, _("Password reset"), action=url_for("account.reset", uid=uid, hash=hash)) }}
    diff --git a/canaille/templates/users.html b/canaille/templates/users.html index 432d332a..3adb6888 100644 --- a/canaille/templates/users.html +++ b/canaille/templates/users.html @@ -1,5 +1,4 @@ {% extends 'base.html' %} -{% import 'flask.j2' as flask %} {% block style %} @@ -13,8 +12,6 @@ {% endblock %} {% block content %} -{{ flask.messages() }} -