From fe8929d9920ae2af86c6544f269cd0de75844259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89loi=20Rivard?= Date: Thu, 19 Dec 2024 00:16:58 +0100 Subject: [PATCH] refactor: move templates in a common directory without this, theming was broken because it needs one single directory for templates. --- canaille/app/flask.py | 9 +++-- canaille/core/endpoints/__init__.py | 2 +- canaille/core/endpoints/account.py | 38 ++++++++++--------- canaille/core/endpoints/admin.py | 34 ++++++++--------- canaille/core/endpoints/auth.py | 36 +++++++++--------- canaille/core/endpoints/groups.py | 14 ++++--- canaille/core/mails.py | 32 ++++++++-------- canaille/core/sms.py | 2 +- canaille/oidc/endpoints/__init__.py | 2 +- canaille/oidc/endpoints/authorizations.py | 4 +- canaille/oidc/endpoints/clients.py | 12 +++--- canaille/oidc/endpoints/consents.py | 4 +- canaille/oidc/endpoints/oauth.py | 8 ++-- canaille/oidc/endpoints/tokens.py | 6 +-- .../templates => templates/core}/about.html | 0 .../core}/firstlogin.html | 0 .../core}/forgotten-password.html | 0 .../templates => templates/core}/group.html | 2 +- .../templates => templates/core}/groups.html | 2 +- .../templates => templates/core}/invite.html | 0 .../templates => templates/core}/join.html | 2 +- .../templates => templates/core}/login.html | 2 +- .../core}/mails/admin.html | 0 .../compromised_password_check_failure.html | 0 .../compromised_password_check_failure.txt | 0 .../core}/mails/email-confirmation.html | 0 .../core}/mails/email-confirmation.txt | 0 .../core}/mails/email_otp.html | 0 .../core}/mails/email_otp.txt | 0 .../core}/mails/firstlogin.html | 0 .../core}/mails/firstlogin.txt | 0 .../core}/mails/invitation.html | 0 .../core}/mails/invitation.txt | 0 .../core}/mails/registration.html | 0 .../core}/mails/registration.txt | 0 .../core}/mails/reset.html | 0 .../core}/mails/reset.txt | 0 .../core}/mails/test.html | 0 .../core}/mails/test.txt | 0 .../core}/modals/delete-account.html | 0 .../core}/modals/delete-group.html | 0 .../core}/modals/lock-account.html | 0 .../core}/modals/remove-group-member.html | 0 .../core}/modals/reset-otp.html | 0 .../core}/partial/group-members.html | 0 .../core}/partial/groups.html | 0 .../core}/partial/login_field.html | 0 .../core}/partial/profile_field.html | 0 .../core}/partial/users.html | 0 .../core}/password.html | 2 +- .../core}/profile_add.html | 2 +- .../core}/profile_edit.html | 2 +- .../core}/profile_settings.html | 0 .../core}/reset-password.html | 0 .../core}/setup-2fa.html | 2 +- .../core}/sms/sms_otp.txt | 0 .../templates => templates/core}/users.html | 2 +- .../core}/verify-2fa.html | 2 +- .../oidc}/authorization_list.html | 2 +- .../oidc}/authorization_view.html | 0 .../oidc}/authorize.html | 0 .../oidc}/client_add.html | 0 .../oidc}/client_edit.html | 0 .../oidc}/client_list.html | 2 +- .../oidc}/consent_list.html | 0 .../templates => templates/oidc}/logout.html | 0 .../oidc}/modals/delete-client.html | 0 .../oidc}/modals/revoke-token.html | 0 .../oidc}/partial/authorization_list.html | 0 .../oidc}/partial/client_list.html | 0 .../oidc}/partial/token_list.html | 0 .../oidc}/preconsent_list.html | 0 .../oidc}/token_list.html | 2 +- .../oidc}/token_view.html | 0 tests/oidc/test_client_admin.py | 2 +- 75 files changed, 120 insertions(+), 111 deletions(-) rename canaille/{core/templates => templates/core}/about.html (100%) rename canaille/{core/templates => templates/core}/firstlogin.html (100%) rename canaille/{core/templates => templates/core}/forgotten-password.html (100%) rename canaille/{core/templates => templates/core}/group.html (98%) rename canaille/{core/templates => templates/core}/groups.html (94%) rename canaille/{core/templates => templates/core}/invite.html (100%) rename canaille/{core/templates => templates/core}/join.html (97%) rename canaille/{core/templates => templates/core}/login.html (97%) rename canaille/{core/templates => templates/core}/mails/admin.html (100%) rename canaille/{core/templates => templates/core}/mails/compromised_password_check_failure.html (100%) rename canaille/{core/templates => templates/core}/mails/compromised_password_check_failure.txt (100%) rename canaille/{core/templates => templates/core}/mails/email-confirmation.html (100%) rename canaille/{core/templates => templates/core}/mails/email-confirmation.txt (100%) rename canaille/{core/templates => templates/core}/mails/email_otp.html (100%) rename canaille/{core/templates => templates/core}/mails/email_otp.txt (100%) rename canaille/{core/templates => templates/core}/mails/firstlogin.html (100%) rename canaille/{core/templates => templates/core}/mails/firstlogin.txt (100%) rename canaille/{core/templates => templates/core}/mails/invitation.html (100%) rename canaille/{core/templates => templates/core}/mails/invitation.txt (100%) rename canaille/{core/templates => templates/core}/mails/registration.html (100%) rename canaille/{core/templates => templates/core}/mails/registration.txt (100%) rename canaille/{core/templates => templates/core}/mails/reset.html (100%) rename canaille/{core/templates => templates/core}/mails/reset.txt (100%) rename canaille/{core/templates => templates/core}/mails/test.html (100%) rename canaille/{core/templates => templates/core}/mails/test.txt (100%) rename canaille/{core/templates => templates/core}/modals/delete-account.html (100%) rename canaille/{core/templates => templates/core}/modals/delete-group.html (100%) rename canaille/{core/templates => templates/core}/modals/lock-account.html (100%) rename canaille/{core/templates => templates/core}/modals/remove-group-member.html (100%) rename canaille/{core/templates => templates/core}/modals/reset-otp.html (100%) rename canaille/{core/templates => templates/core}/partial/group-members.html (100%) rename canaille/{core/templates => templates/core}/partial/groups.html (100%) rename canaille/{core/templates => templates/core}/partial/login_field.html (100%) rename canaille/{core/templates => templates/core}/partial/profile_field.html (100%) rename canaille/{core/templates => templates/core}/partial/users.html (100%) rename canaille/{core/templates => templates/core}/password.html (97%) rename canaille/{core/templates => templates/core}/profile_add.html (99%) rename canaille/{core/templates => templates/core}/profile_edit.html (99%) rename canaille/{core/templates => templates/core}/profile_settings.html (100%) rename canaille/{core/templates => templates/core}/reset-password.html (100%) rename canaille/{core/templates => templates/core}/setup-2fa.html (98%) rename canaille/{core/templates => templates/core}/sms/sms_otp.txt (100%) rename canaille/{core/templates => templates/core}/users.html (95%) rename canaille/{core/templates => templates/core}/verify-2fa.html (98%) rename canaille/{oidc/templates => templates/oidc}/authorization_list.html (95%) rename canaille/{oidc/templates => templates/oidc}/authorization_view.html (100%) rename canaille/{oidc/templates => templates/oidc}/authorize.html (100%) rename canaille/{oidc/templates => templates/oidc}/client_add.html (100%) rename canaille/{oidc/templates => templates/oidc}/client_edit.html (100%) rename canaille/{oidc/templates => templates/oidc}/client_list.html (96%) rename canaille/{oidc/templates => templates/oidc}/consent_list.html (100%) rename canaille/{oidc/templates => templates/oidc}/logout.html (100%) rename canaille/{oidc/templates => templates/oidc}/modals/delete-client.html (100%) rename canaille/{oidc/templates => templates/oidc}/modals/revoke-token.html (100%) rename canaille/{oidc/templates => templates/oidc}/partial/authorization_list.html (100%) rename canaille/{oidc/templates => templates/oidc}/partial/client_list.html (100%) rename canaille/{oidc/templates => templates/oidc}/partial/token_list.html (100%) rename canaille/{oidc/templates => templates/oidc}/preconsent_list.html (100%) rename canaille/{oidc/templates => templates/oidc}/token_list.html (96%) rename canaille/{oidc/templates => templates/oidc}/token_view.html (100%) diff --git a/canaille/app/flask.py b/canaille/app/flask.py index 32f99ee4..73597653 100644 --- a/canaille/app/flask.py +++ b/canaille/app/flask.py @@ -85,9 +85,12 @@ def request_is_htmx(): def render_htmx_template(template, htmx_template=None, **kwargs): - template = ( - (htmx_template or f"partial/{template}") if request_is_htmx() else template - ) + if request_is_htmx(): + if htmx_template: + template = htmx_template + else: + *dirs, file = template.split("/") + template = "/".join([*dirs, "partial", file]) return render_template(template, **kwargs) diff --git a/canaille/core/endpoints/__init__.py b/canaille/core/endpoints/__init__.py index 29d2d3ae..0a1dd9a1 100644 --- a/canaille/core/endpoints/__init__.py +++ b/canaille/core/endpoints/__init__.py @@ -5,7 +5,7 @@ from . import admin from . import auth from . import groups -bp = Blueprint("core", __name__, template_folder="../templates") +bp = Blueprint("core", __name__) bp.register_blueprint(account.bp) bp.register_blueprint(admin.bp) diff --git a/canaille/core/endpoints/account.py b/canaille/core/endpoints/account.py index c0dc9fa0..76680ceb 100644 --- a/canaille/core/endpoints/account.py +++ b/canaille/core/endpoints/account.py @@ -94,7 +94,7 @@ def join(): ), "success", ) - return render_template("join.html", form=form) + return render_template("core/join.html", form=form) payload = RegistrationPayload( creation_date_isoformat=datetime.datetime.now( @@ -130,13 +130,13 @@ def join(): "error", ) - return render_template("join.html", form=form) + return render_template("core/join.html", form=form) @bp.route("/about") def about(): version = metadata.version("canaille") - return render_template("about.html", version=version) + return render_template("core/about.html", version=version) @bp.route("/users", methods=["GET", "POST"]) @@ -151,7 +151,7 @@ def users(user): abort(404) return render_htmx_template( - "users.html", + "core/users.html", menuitem="users", table_form=table_form, ) @@ -221,7 +221,7 @@ def user_invitation(user): email_sent = send_invitation_mail(form.email.data, registration_url) return render_template( - "invite.html", + "core/invite.html", form=form, menuitems="users", form_validated=form_validated, @@ -328,7 +328,7 @@ def registration(data=None, hash=None): if not request.form or form.form_control(): return render_template( - "profile_add.html", + "core/profile_add.html", form=form, menuitem="users", edited_user=None, @@ -338,7 +338,7 @@ def registration(data=None, hash=None): if not form.validate(): flash(_("User account creation failed."), "error") return render_template( - "profile_add.html", + "core/profile_add.html", form=form, menuitem="users", edited_user=None, @@ -421,7 +421,7 @@ def profile_creation(user): if not request.form or form.form_control(): return render_template( - "profile_add.html", + "core/profile_add.html", form=form, menuitem="users", edited_user=None, @@ -431,7 +431,7 @@ def profile_creation(user): if not form.validate(): flash(_("User account creation failed."), "error") return render_template( - "profile_add.html", + "core/profile_add.html", form=form, menuitem="users", edited_user=None, @@ -505,7 +505,7 @@ def profile_edition_main_form(user, edited_user, emails_readonly): profile_form = build_profile_form(writable_fields, readable_fields) profile_form.process(request_data or None, data=data) profile_form.user = edited_user - profile_form.render_field_macro_file = "partial/profile_field.html" + profile_form.render_field_macro_file = "core/partial/profile_field.html" profile_form.render_field_extra_context = { "user": user, "edited_user": edited_user, @@ -611,12 +611,12 @@ def profile_edition(user, edited_user): } if not request.form or profile_form.form_control(): - return render_template("profile_edit.html", **render_context) + return render_template("core/profile_edit.html", **render_context) if request_is_htmx() or request.form.get("action") == "edit-profile": if not profile_form.validate(): flash(_("Profile edition failed."), "error") - return render_template("profile_edit.html", **render_context) + return render_template("core/profile_edit.html", **render_context) profile_edition_main_form_validation(user, edited_user, profile_form) @@ -634,7 +634,7 @@ def profile_edition(user, edited_user): if request.form.get("action") == "add_email": if not emails_form.validate(): flash(_("Email addition failed."), "error") - return render_template("profile_edit.html", **render_context) + return render_template("core/profile_edit.html", **render_context) if profile_edition_add_email(user, edited_user, emails_form): flash( @@ -656,7 +656,7 @@ def profile_edition(user, edited_user): user, edited_user, request.form.get("email_remove") ): flash(_("Email deletion failed."), "error") - return render_template("profile_edit.html", **render_context) + return render_template("core/profile_edit.html", **render_context) flash(_("The email have been successfully deleted."), "success") return redirect( @@ -682,7 +682,9 @@ def profile_settings(user, edited_user): return profile_settings_edit(user, edited_user) if request.form.get("action") == "confirm-delete": - return render_template("modals/delete-account.html", edited_user=edited_user) + return render_template( + "core/modals/delete-account.html", edited_user=edited_user + ) if request.form.get("action") == "delete": return profile_delete(user, edited_user) @@ -729,7 +731,7 @@ def profile_settings(user, edited_user): and current_app.features.has_account_lockability and not edited_user.locked ): - return render_template("modals/lock-account.html", edited_user=edited_user) + return render_template("core/modals/lock-account.html", edited_user=edited_user) if ( request.form.get("action") == "lock" @@ -757,7 +759,7 @@ def profile_settings(user, edited_user): request.form.get("action") == "confirm-reset-otp" and current_app.features.has_otp ): - return render_template("modals/reset-otp.html", edited_user=edited_user) + return render_template("core/modals/reset-otp.html", edited_user=edited_user) if request.form.get("action") == "reset-otp" and current_app.features.has_otp: flash(_("One-time password authentication has been reset"), "success") @@ -825,7 +827,7 @@ def profile_settings_edit(editor, edited_user): ) return render_template( - "profile_settings.html", + "core/profile_settings.html", form=form, menuitem=menuitem, edited_user=edited_user, diff --git a/canaille/core/endpoints/admin.py b/canaille/core/endpoints/admin.py index c3f65d15..8a23ea82 100644 --- a/canaille/core/endpoints/admin.py +++ b/canaille/core/endpoints/admin.py @@ -43,7 +43,7 @@ def mail_index(user): else: flash(_("The test mail has not been sent correctly"), "error") - return render_template("mails/admin.html", form=form, menuitem="admin") + return render_template("core/mails/admin.html", form=form, menuitem="admin") @bp.route("/mail/test.html") @@ -51,7 +51,7 @@ def mail_index(user): def test_html(user): base_url = url_for("core.account.index", _external=True) return render_template( - "mails/test.html", + "core/mails/test.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, logo=current_app.config["CANAILLE"]["LOGO"], @@ -66,7 +66,7 @@ def test_html(user): def test_txt(user): base_url = url_for("core.account.index", _external=True) return render_template( - "mails/test.txt", + "core/mails/test.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=current_app.config.get("SERVER_NAME", base_url), ) @@ -87,7 +87,7 @@ def password_init_html(user): ) return render_template( - "mails/firstlogin.html", + "core/mails/firstlogin.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, reset_url=reset_url, @@ -110,7 +110,7 @@ def password_init_txt(user): ) return render_template( - "mails/firstlogin.txt", + "core/mails/firstlogin.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=current_app.config.get("SERVER_NAME", base_url), reset_url=reset_url, @@ -132,7 +132,7 @@ def password_reset_html(user): ) return render_template( - "mails/reset.html", + "core/mails/reset.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, reset_url=reset_url, @@ -155,7 +155,7 @@ def password_reset_txt(user): ) return render_template( - "mails/reset.txt", + "core/mails/reset.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=current_app.config.get("SERVER_NAME", base_url), reset_url=reset_url, @@ -174,7 +174,7 @@ def invitation_html(user, identifier, email): ) return render_template( - "mails/invitation.html", + "core/mails/invitation.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, registration_url=registration_url, @@ -197,7 +197,7 @@ def invitation_txt(user, identifier, email): ) return render_template( - "mails/invitation.txt", + "core/mails/invitation.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, registration_url=registration_url, @@ -216,7 +216,7 @@ def email_confirmation_html(user, identifier, email): ) return render_template( - "mails/email-confirmation.html", + "core/mails/email-confirmation.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, confirmation_url=email_confirmation_url, @@ -239,7 +239,7 @@ def email_confirmation_txt(user, identifier, email): ) return render_template( - "mails/email-confirmation.txt", + "core/mails/email-confirmation.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, confirmation_url=email_confirmation_url, @@ -258,7 +258,7 @@ def registration_html(user, email): ) return render_template( - "mails/registration.html", + "core/mails/registration.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, registration_url=registration_url, @@ -281,7 +281,7 @@ def registration_txt(user, email): ) return render_template( - "mails/registration.txt", + "core/mails/registration.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, registration_url=registration_url, @@ -298,7 +298,7 @@ def compromised_password_check_failure_html(user): user_email = "" return render_template( - "mails/compromised_password_check_failure.html", + "core/mails/compromised_password_check_failure.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, user_name=user_name, @@ -322,7 +322,7 @@ def compromised_password_check_failure_txt(user): user_email = "" return render_template( - "mails/compromised_password_check_failure.txt", + "core/mails/compromised_password_check_failure.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, user_name=user_name, @@ -339,7 +339,7 @@ def email_otp_html(user): otp = "000000" return render_template( - "mails/email_otp.html", + "core/mails/email_otp.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, otp=otp, @@ -357,7 +357,7 @@ def email_otp_txt(user): otp = "000000" return render_template( - "mails/email_otp.txt", + "core/mails/email_otp.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, otp=otp, diff --git a/canaille/core/endpoints/auth.py b/canaille/core/endpoints/auth.py index 468d9ffa..7f67ca4c 100644 --- a/canaille/core/endpoints/auth.py +++ b/canaille/core/endpoints/auth.py @@ -49,11 +49,11 @@ def login(): ) form = LoginForm(request.form or None) - form.render_field_macro_file = "partial/login_field.html" + form.render_field_macro_file = "core/partial/login_field.html" form["login"].render_kw["placeholder"] = Backend.instance.login_placeholder() if not request.form or form.form_control(): - return render_template("login.html", form=form) + return render_template("core/login.html", form=form) user = Backend.instance.get_user_from_login(form.login.data) if user and not user.has_password() and current_app.features.has_smtp: @@ -62,7 +62,7 @@ def login(): if not form.validate(): logout_user() flash(_("Login failed, please check your information"), "error") - return render_template("login.html", form=form) + return render_template("core/login.html", form=form) session["attempt_login"] = form.login.data return redirect(url_for("core.auth.password")) @@ -80,11 +80,11 @@ def password(): return redirect(url_for("core.auth.login")) form = PasswordForm(request.form or None) - form.render_field_macro_file = "partial/login_field.html" + form.render_field_macro_file = "core/partial/login_field.html" if not request.form or form.form_control(): return render_template( - "password.html", form=form, username=session["attempt_login"] + "core/password.html", form=form, username=session["attempt_login"] ) user = Backend.instance.get_user_from_login(session["attempt_login"]) @@ -95,7 +95,7 @@ def password(): logout_user() flash(_("Login failed, please check your information"), "error") return render_template( - "password.html", form=form, username=session["attempt_login"] + "core/password.html", form=form, username=session["attempt_login"] ) success, message = Backend.instance.check_user_password(user, form.password.data) @@ -107,7 +107,7 @@ def password(): ) flash(message or _("Login failed, please check your information"), "error") return render_template( - "password.html", form=form, username=session["attempt_login"] + "core/password.html", form=form, username=session["attempt_login"] ) otp_methods = [] @@ -165,7 +165,7 @@ def firstlogin(user): form = FirstLoginForm(request.form or None) if not request.form: - return render_template("firstlogin.html", form=form, user=user) + return render_template("core/firstlogin.html", form=form, user=user) form.validate() @@ -182,7 +182,7 @@ def firstlogin(user): else: flash(_("Could not send the password initialization email"), "error") - return render_template("firstlogin.html", form=form) + return render_template("core/firstlogin.html", form=form) @bp.route("/reset", methods=["GET", "POST"]) @@ -193,11 +193,11 @@ def forgotten(): form = ForgottenPasswordForm(request.form) if not request.form: - return render_template("forgotten-password.html", form=form) + return render_template("core/forgotten-password.html", form=form) if not form.validate(): flash(_("Could not send the password reset link."), "error") - return render_template("forgotten-password.html", form=form) + return render_template("core/forgotten-password.html", form=form) user = Backend.instance.get_user_from_login(form.login.data) success_message = _( @@ -208,7 +208,7 @@ def forgotten(): not user or not user.can_edit_self ): flash(success_message, "success") - return render_template("forgotten-password.html", form=form) + return render_template("core/forgotten-password.html", form=form) if not user.can_edit_self: flash( @@ -219,7 +219,7 @@ def forgotten(): ), "error", ) - return render_template("forgotten-password.html", form=form) + return render_template("core/forgotten-password.html", form=form) request_ip = request.remote_addr or "unknown IP" success = True @@ -238,7 +238,7 @@ def forgotten(): "error", ) - return render_template("forgotten-password.html", form=form) + return render_template("core/forgotten-password.html", form=form) @bp.route("/reset//", methods=["GET", "POST"]) @@ -274,7 +274,7 @@ def reset(user, hash): ) ) - return render_template("reset-password.html", form=form, user=user, hash=hash) + return render_template("core/reset-password.html", form=form, user=user, hash=hash) @bp.route("/setup-2fa") @@ -298,7 +298,7 @@ def setup_two_factor_auth(): uri = user.get_otp_authentication_setup_uri() base64_qr_image = get_b64encoded_qr_image(uri) return render_template( - "setup-2fa.html", + "core/setup-2fa.html", secret=user.secret_token, qr_image=base64_qr_image, username=user.user_name, @@ -331,11 +331,11 @@ def verify_two_factor_auth(): abort(404) form = TwoFactorForm(request.form or None) - form.render_field_macro_file = "partial/login_field.html" + form.render_field_macro_file = "core/partial/login_field.html" if not request.form or form.form_control(): return render_template( - "verify-2fa.html", + "core/verify-2fa.html", form=form, username=session["attempt_login_with_correct_password"], method=current_otp_method, diff --git a/canaille/core/endpoints/groups.py b/canaille/core/endpoints/groups.py index acaa3d80..19efaf63 100644 --- a/canaille/core/endpoints/groups.py +++ b/canaille/core/endpoints/groups.py @@ -27,7 +27,9 @@ def groups(user): if request.form and request.form.get("page") and not table_form.validate(): abort(404) - return render_htmx_template("groups.html", menuitem="groups", table_form=table_form) + return render_htmx_template( + "core/groups.html", menuitem="groups", table_form=table_form + ) @bp.route("/add", methods=("GET", "POST")) @@ -54,7 +56,7 @@ def create_group(user): return redirect(url_for("core.groups.group", group=group)) return render_template( - "group.html", menuitem="groups", form=form, edited_group=None, members=None + "core/group.html", menuitem="groups", form=form, edited_group=None, members=None ) @@ -69,7 +71,7 @@ def group(user, group): return edit_group(group) if request.form.get("action") == "confirm-delete": - return render_template("modals/delete-group.html", group=group) + return render_template("core/modals/delete-group.html", group=group) if request.form.get("action") == "delete": return delete_group(group) @@ -116,8 +118,8 @@ def edit_group(group): flash(_("Group edition failed."), "error") return render_htmx_template( - "group.html", - "partial/group-members.html", + "core/group.html", + "core/partial/group-members.html", form=form, menuitem="groups", edited_group=group, @@ -137,7 +139,7 @@ def delete_member(group): elif request.form.get("action") == "confirm-remove-member": return render_template( - "modals/remove-group-member.html", group=group, form=form + "core/modals/remove-group-member.html", group=group, form=form ) else: diff --git a/canaille/core/mails.py b/canaille/core/mails.py index db9e28dc..4085491b 100644 --- a/canaille/core/mails.py +++ b/canaille/core/mails.py @@ -16,12 +16,12 @@ def send_test_mail(email): website_name=current_app.config["CANAILLE"]["NAME"] ) text_body = render_template( - "mails/test.txt", + "core/mails/test.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, ) html_body = render_template( - "mails/test.html", + "core/mails/test.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, logo=f"cid:{logo_cid[1:-1]}" if logo_cid else None, @@ -55,13 +55,13 @@ def send_password_reset_mail(user, mail): website_name=current_app.config["CANAILLE"]["NAME"] ) text_body = render_template( - "mails/reset.txt", + "core/mails/reset.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, reset_url=reset_url, ) html_body = render_template( - "mails/reset.html", + "core/mails/reset.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, reset_url=reset_url, @@ -96,13 +96,13 @@ def send_password_initialization_mail(user, email): website_name=current_app.config["CANAILLE"]["NAME"] ) text_body = render_template( - "mails/firstlogin.txt", + "core/mails/firstlogin.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, reset_url=reset_url, ) html_body = render_template( - "mails/firstlogin.html", + "core/mails/firstlogin.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, reset_url=reset_url, @@ -127,13 +127,13 @@ def send_invitation_mail(email, registration_url): website_name=current_app.config["CANAILLE"]["NAME"] ) text_body = render_template( - "mails/invitation.txt", + "core/mails/invitation.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, registration_url=registration_url, ) html_body = render_template( - "mails/invitation.html", + "core/mails/invitation.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, registration_url=registration_url, @@ -158,13 +158,13 @@ def send_confirmation_email(email, confirmation_url): website_name=current_app.config["CANAILLE"]["NAME"] ) text_body = render_template( - "mails/email-confirmation.txt", + "core/mails/email-confirmation.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, confirmation_url=confirmation_url, ) html_body = render_template( - "mails/email-confirmation.html", + "core/mails/email-confirmation.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, confirmation_url=confirmation_url, @@ -189,13 +189,13 @@ def send_registration_mail(email, registration_url): website_name=current_app.config["CANAILLE"]["NAME"] ) text_body = render_template( - "mails/registration.txt", + "core/mails/registration.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, registration_url=registration_url, ) html_body = render_template( - "mails/registration.html", + "core/mails/registration.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, registration_url=registration_url, @@ -222,7 +222,7 @@ def send_compromised_password_check_failure_mail( website_name=current_app.config["CANAILLE"]["NAME"] ) text_body = render_template( - "mails/compromised_password_check_failure.txt", + "core/mails/compromised_password_check_failure.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, check_password_url=check_password_url, @@ -231,7 +231,7 @@ def send_compromised_password_check_failure_mail( hashed_password=hashed_password, ) html_body = render_template( - "mails/compromised_password_check_failure.html", + "core/mails/compromised_password_check_failure.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, check_password_url=check_password_url, @@ -259,13 +259,13 @@ def send_one_time_password_mail(mail, otp): website_name=current_app.config["CANAILLE"]["NAME"] ) text_body = render_template( - "mails/email_otp.txt", + "core/mails/email_otp.txt", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, otp=otp, ) html_body = render_template( - "mails/email_otp.html", + "core/mails/email_otp.html", site_name=current_app.config["CANAILLE"]["NAME"], site_url=base_url, otp=otp, diff --git a/canaille/core/sms.py b/canaille/core/sms.py index dcfc4de0..83d04566 100644 --- a/canaille/core/sms.py +++ b/canaille/core/sms.py @@ -8,7 +8,7 @@ def send_one_time_password_sms(phone_number, otp): website_name = current_app.config["CANAILLE"]["NAME"] text_body = render_template( - "sms/sms_otp.txt", + "core/sms/sms_otp.txt", website_name=website_name, otp=otp, ) diff --git a/canaille/oidc/endpoints/__init__.py b/canaille/oidc/endpoints/__init__.py index cc1d7452..6423d1a4 100644 --- a/canaille/oidc/endpoints/__init__.py +++ b/canaille/oidc/endpoints/__init__.py @@ -7,7 +7,7 @@ from . import oauth from . import tokens from . import well_known -bp = Blueprint("oidc", __name__, template_folder="../templates") +bp = Blueprint("oidc", __name__) bp.register_blueprint(authorizations.bp) bp.register_blueprint(clients.bp) diff --git a/canaille/oidc/endpoints/authorizations.py b/canaille/oidc/endpoints/authorizations.py index a227168b..c4cbce20 100644 --- a/canaille/oidc/endpoints/authorizations.py +++ b/canaille/oidc/endpoints/authorizations.py @@ -19,7 +19,7 @@ def index(user): abort(404) return render_htmx_template( - "authorization_list.html", + "oidc/authorization_list.html", menuitem="admin", table_form=table_form, ) @@ -29,7 +29,7 @@ def index(user): @permissions_needed("manage_oidc") def view(user, authorization): return render_template( - "authorization_view.html", + "oidc/authorization_view.html", authorization=authorization, menuitem="admin", ) diff --git a/canaille/oidc/endpoints/clients.py b/canaille/oidc/endpoints/clients.py index 8f29ceca..13ae71ce 100644 --- a/canaille/oidc/endpoints/clients.py +++ b/canaille/oidc/endpoints/clients.py @@ -30,7 +30,7 @@ def index(user): abort(404) return render_htmx_template( - "client_list.html", menuitem="admin", table_form=table_form + "oidc/client_list.html", menuitem="admin", table_form=table_form ) @@ -40,14 +40,14 @@ def add(user): form = ClientAddForm(request.form or None) if not request.form or form.form_control(): - return render_template("client_add.html", form=form, menuitem="admin") + return render_template("oidc/client_add.html", form=form, menuitem="admin") if not form.validate(): flash( _("The client has not been added. Please check your information."), "error", ) - return render_template("client_add.html", form=form, menuitem="admin") + return render_template("oidc/client_add.html", form=form, menuitem="admin") client_id = gen_salt(24) client_id_issued_at = datetime.datetime.now(datetime.timezone.utc) @@ -90,7 +90,7 @@ def add(user): @permissions_needed("manage_oidc") def edit(user, client): if request.form.get("action") == "confirm-delete": - return render_template("modals/delete-client.html", client=client) + return render_template("oidc/modals/delete-client.html", client=client) if request.form and request.form.get("action") == "delete": return client_delete(client) @@ -110,7 +110,7 @@ def client_edit(client): if not request.form or form.form_control(): return render_template( - "client_edit.html", form=form, client=client, menuitem="admin" + "oidc/client_edit.html", form=form, client=client, menuitem="admin" ) if not form.validate(): @@ -119,7 +119,7 @@ def client_edit(client): "error", ) return render_template( - "client_edit.html", form=form, client=client, menuitem="admin" + "oidc/client_edit.html", form=form, client=client, menuitem="admin" ) Backend.instance.update( diff --git a/canaille/oidc/endpoints/consents.py b/canaille/oidc/endpoints/consents.py index a9976214..d497c3e9 100644 --- a/canaille/oidc/endpoints/consents.py +++ b/canaille/oidc/endpoints/consents.py @@ -33,7 +33,7 @@ def consents(user): ) return render_template( - "consent_list.html", + "oidc/consent_list.html", consents=consents, menuitem="consents", scope_details=SCOPE_DETAILS, @@ -58,7 +58,7 @@ def pre_consents(user): nb_preconsents = len(preconsented) return render_template( - "preconsent_list.html", + "oidc/preconsent_list.html", menuitem="consents", scope_details=SCOPE_DETAILS, ignored_scopes=["openid"], diff --git a/canaille/oidc/endpoints/oauth.py b/canaille/oidc/endpoints/oauth.py index 5f3529a7..f87616f1 100644 --- a/canaille/oidc/endpoints/oauth.py +++ b/canaille/oidc/endpoints/oauth.py @@ -143,7 +143,7 @@ def authorize_consent(client, user): form = AuthorizeForm(request.form or None) return render_template( - "authorize.html", + "oidc/authorize.html", user=user, grant=grant, client=client, @@ -307,7 +307,7 @@ def end_session(): or (data.get("logout_hint") and data["logout_hint"] != user.user_name) ) and not session.get("end_session_confirmation"): session["end_session_data"] = data - return render_template("logout.html", form=form, client=client, menu=False) + return render_template("oidc/logout.html", form=form, client=client, menu=False) if data.get("id_token_hint"): try: @@ -358,7 +358,9 @@ def end_session(): "end_session_confirmation" ): session["end_session_data"] = data - return render_template("logout.html", form=form, client=client, menu=False) + return render_template( + "oidc/logout.html", form=form, client=client, menu=False + ) logout_user() diff --git a/canaille/oidc/endpoints/tokens.py b/canaille/oidc/endpoints/tokens.py index 543e4ace..a91e5481 100644 --- a/canaille/oidc/endpoints/tokens.py +++ b/canaille/oidc/endpoints/tokens.py @@ -27,7 +27,7 @@ def index(user): abort(404) return render_htmx_template( - "token_list.html", menuitem="admin", table_form=table_form + "oidc/token_list.html", menuitem="admin", table_form=table_form ) @@ -38,7 +38,7 @@ def view(user, token): if request.form and form.validate(): if request.form.get("action") == "confirm-revoke": - return render_template("modals/revoke-token.html", token=token) + return render_template("oidc/modals/revoke-token.html", token=token) elif request.form.get("action") == "revoke": token.revokation_date = datetime.datetime.now(datetime.timezone.utc) @@ -53,7 +53,7 @@ def view(user, token): abort(400, f"bad form action: {request.form.get('action')}") return render_template( - "token_view.html", + "oidc/token_view.html", token=token, menuitem="admin", form=form, diff --git a/canaille/core/templates/about.html b/canaille/templates/core/about.html similarity index 100% rename from canaille/core/templates/about.html rename to canaille/templates/core/about.html diff --git a/canaille/core/templates/firstlogin.html b/canaille/templates/core/firstlogin.html similarity index 100% rename from canaille/core/templates/firstlogin.html rename to canaille/templates/core/firstlogin.html diff --git a/canaille/core/templates/forgotten-password.html b/canaille/templates/core/forgotten-password.html similarity index 100% rename from canaille/core/templates/forgotten-password.html rename to canaille/templates/core/forgotten-password.html diff --git a/canaille/core/templates/group.html b/canaille/templates/core/group.html similarity index 98% rename from canaille/core/templates/group.html rename to canaille/templates/core/group.html index 8f01e3f9..506207a6 100644 --- a/canaille/core/templates/group.html +++ b/canaille/templates/core/group.html @@ -80,7 +80,7 @@ {{ table.search(table_form, "table.users") }} - {% include "partial/group-members.html" %} + {% include "core/partial/group-members.html" %} {% endif %} {% endblock %} diff --git a/canaille/core/templates/groups.html b/canaille/templates/core/groups.html similarity index 94% rename from canaille/core/templates/groups.html rename to canaille/templates/core/groups.html index 95051c1a..5ccc5611 100644 --- a/canaille/core/templates/groups.html +++ b/canaille/templates/core/groups.html @@ -25,5 +25,5 @@ {{ table.search(table_form, "table.groups") }} - {% include "partial/groups.html" %} + {% include "core/partial/groups.html" %} {% endblock %} diff --git a/canaille/core/templates/invite.html b/canaille/templates/core/invite.html similarity index 100% rename from canaille/core/templates/invite.html rename to canaille/templates/core/invite.html diff --git a/canaille/core/templates/join.html b/canaille/templates/core/join.html similarity index 97% rename from canaille/core/templates/join.html rename to canaille/templates/core/join.html index 047958b0..a37a6873 100644 --- a/canaille/core/templates/join.html +++ b/canaille/templates/core/join.html @@ -1,6 +1,6 @@ {% extends theme('base.html') %} {% import 'macro/form.html' as fui %} -{% import 'partial/profile_field.html' as profile %} +{% import 'core/partial/profile_field.html' as profile %} {%- block title -%} {%- trans %}User creation{% endtrans -%} diff --git a/canaille/core/templates/login.html b/canaille/templates/core/login.html similarity index 97% rename from canaille/core/templates/login.html rename to canaille/templates/core/login.html index ac181aba..bc353e7e 100644 --- a/canaille/core/templates/login.html +++ b/canaille/templates/core/login.html @@ -1,7 +1,7 @@ {% extends theme('base.html') %} {% import 'macro/flask.html' as flask %} {% import 'macro/form.html' as fui %} -{% import 'partial/login_field.html' as login_field %} +{% import 'core/partial/login_field.html' as login_field %} {% block container %}
diff --git a/canaille/core/templates/mails/admin.html b/canaille/templates/core/mails/admin.html similarity index 100% rename from canaille/core/templates/mails/admin.html rename to canaille/templates/core/mails/admin.html diff --git a/canaille/core/templates/mails/compromised_password_check_failure.html b/canaille/templates/core/mails/compromised_password_check_failure.html similarity index 100% rename from canaille/core/templates/mails/compromised_password_check_failure.html rename to canaille/templates/core/mails/compromised_password_check_failure.html diff --git a/canaille/core/templates/mails/compromised_password_check_failure.txt b/canaille/templates/core/mails/compromised_password_check_failure.txt similarity index 100% rename from canaille/core/templates/mails/compromised_password_check_failure.txt rename to canaille/templates/core/mails/compromised_password_check_failure.txt diff --git a/canaille/core/templates/mails/email-confirmation.html b/canaille/templates/core/mails/email-confirmation.html similarity index 100% rename from canaille/core/templates/mails/email-confirmation.html rename to canaille/templates/core/mails/email-confirmation.html diff --git a/canaille/core/templates/mails/email-confirmation.txt b/canaille/templates/core/mails/email-confirmation.txt similarity index 100% rename from canaille/core/templates/mails/email-confirmation.txt rename to canaille/templates/core/mails/email-confirmation.txt diff --git a/canaille/core/templates/mails/email_otp.html b/canaille/templates/core/mails/email_otp.html similarity index 100% rename from canaille/core/templates/mails/email_otp.html rename to canaille/templates/core/mails/email_otp.html diff --git a/canaille/core/templates/mails/email_otp.txt b/canaille/templates/core/mails/email_otp.txt similarity index 100% rename from canaille/core/templates/mails/email_otp.txt rename to canaille/templates/core/mails/email_otp.txt diff --git a/canaille/core/templates/mails/firstlogin.html b/canaille/templates/core/mails/firstlogin.html similarity index 100% rename from canaille/core/templates/mails/firstlogin.html rename to canaille/templates/core/mails/firstlogin.html diff --git a/canaille/core/templates/mails/firstlogin.txt b/canaille/templates/core/mails/firstlogin.txt similarity index 100% rename from canaille/core/templates/mails/firstlogin.txt rename to canaille/templates/core/mails/firstlogin.txt diff --git a/canaille/core/templates/mails/invitation.html b/canaille/templates/core/mails/invitation.html similarity index 100% rename from canaille/core/templates/mails/invitation.html rename to canaille/templates/core/mails/invitation.html diff --git a/canaille/core/templates/mails/invitation.txt b/canaille/templates/core/mails/invitation.txt similarity index 100% rename from canaille/core/templates/mails/invitation.txt rename to canaille/templates/core/mails/invitation.txt diff --git a/canaille/core/templates/mails/registration.html b/canaille/templates/core/mails/registration.html similarity index 100% rename from canaille/core/templates/mails/registration.html rename to canaille/templates/core/mails/registration.html diff --git a/canaille/core/templates/mails/registration.txt b/canaille/templates/core/mails/registration.txt similarity index 100% rename from canaille/core/templates/mails/registration.txt rename to canaille/templates/core/mails/registration.txt diff --git a/canaille/core/templates/mails/reset.html b/canaille/templates/core/mails/reset.html similarity index 100% rename from canaille/core/templates/mails/reset.html rename to canaille/templates/core/mails/reset.html diff --git a/canaille/core/templates/mails/reset.txt b/canaille/templates/core/mails/reset.txt similarity index 100% rename from canaille/core/templates/mails/reset.txt rename to canaille/templates/core/mails/reset.txt diff --git a/canaille/core/templates/mails/test.html b/canaille/templates/core/mails/test.html similarity index 100% rename from canaille/core/templates/mails/test.html rename to canaille/templates/core/mails/test.html diff --git a/canaille/core/templates/mails/test.txt b/canaille/templates/core/mails/test.txt similarity index 100% rename from canaille/core/templates/mails/test.txt rename to canaille/templates/core/mails/test.txt diff --git a/canaille/core/templates/modals/delete-account.html b/canaille/templates/core/modals/delete-account.html similarity index 100% rename from canaille/core/templates/modals/delete-account.html rename to canaille/templates/core/modals/delete-account.html diff --git a/canaille/core/templates/modals/delete-group.html b/canaille/templates/core/modals/delete-group.html similarity index 100% rename from canaille/core/templates/modals/delete-group.html rename to canaille/templates/core/modals/delete-group.html diff --git a/canaille/core/templates/modals/lock-account.html b/canaille/templates/core/modals/lock-account.html similarity index 100% rename from canaille/core/templates/modals/lock-account.html rename to canaille/templates/core/modals/lock-account.html diff --git a/canaille/core/templates/modals/remove-group-member.html b/canaille/templates/core/modals/remove-group-member.html similarity index 100% rename from canaille/core/templates/modals/remove-group-member.html rename to canaille/templates/core/modals/remove-group-member.html diff --git a/canaille/core/templates/modals/reset-otp.html b/canaille/templates/core/modals/reset-otp.html similarity index 100% rename from canaille/core/templates/modals/reset-otp.html rename to canaille/templates/core/modals/reset-otp.html diff --git a/canaille/core/templates/partial/group-members.html b/canaille/templates/core/partial/group-members.html similarity index 100% rename from canaille/core/templates/partial/group-members.html rename to canaille/templates/core/partial/group-members.html diff --git a/canaille/core/templates/partial/groups.html b/canaille/templates/core/partial/groups.html similarity index 100% rename from canaille/core/templates/partial/groups.html rename to canaille/templates/core/partial/groups.html diff --git a/canaille/core/templates/partial/login_field.html b/canaille/templates/core/partial/login_field.html similarity index 100% rename from canaille/core/templates/partial/login_field.html rename to canaille/templates/core/partial/login_field.html diff --git a/canaille/core/templates/partial/profile_field.html b/canaille/templates/core/partial/profile_field.html similarity index 100% rename from canaille/core/templates/partial/profile_field.html rename to canaille/templates/core/partial/profile_field.html diff --git a/canaille/core/templates/partial/users.html b/canaille/templates/core/partial/users.html similarity index 100% rename from canaille/core/templates/partial/users.html rename to canaille/templates/core/partial/users.html diff --git a/canaille/core/templates/password.html b/canaille/templates/core/password.html similarity index 97% rename from canaille/core/templates/password.html rename to canaille/templates/core/password.html index 13a027b0..8c288947 100644 --- a/canaille/core/templates/password.html +++ b/canaille/templates/core/password.html @@ -1,7 +1,7 @@ {% extends theme('base.html') %} {% import 'macro/flask.html' as flask %} {% import 'macro/form.html' as fui %} -{% import 'partial/login_field.html' as login_field %} +{% import 'core/partial/login_field.html' as login_field %} {% block container %}
diff --git a/canaille/core/templates/profile_add.html b/canaille/templates/core/profile_add.html similarity index 99% rename from canaille/core/templates/profile_add.html rename to canaille/templates/core/profile_add.html index 77147f3c..58fd8cbc 100644 --- a/canaille/core/templates/profile_add.html +++ b/canaille/templates/core/profile_add.html @@ -1,6 +1,6 @@ {% extends theme('base.html') %} {% import 'macro/form.html' as fui %} -{% import 'partial/profile_field.html' as profile %} +{% import 'core/partial/profile_field.html' as profile %} {%- block title -%} {%- trans %}User creation{% endtrans -%} diff --git a/canaille/core/templates/profile_edit.html b/canaille/templates/core/profile_edit.html similarity index 99% rename from canaille/core/templates/profile_edit.html rename to canaille/templates/core/profile_edit.html index e50fd835..a825de4f 100644 --- a/canaille/core/templates/profile_edit.html +++ b/canaille/templates/core/profile_edit.html @@ -1,6 +1,6 @@ {% extends theme('base.html') %} {% import 'macro/form.html' as fui %} -{% import 'partial/profile_field.html' as profile %} +{% import 'core/partial/profile_field.html' as profile %} {%- block title -%} {% if not edited_user %} diff --git a/canaille/core/templates/profile_settings.html b/canaille/templates/core/profile_settings.html similarity index 100% rename from canaille/core/templates/profile_settings.html rename to canaille/templates/core/profile_settings.html diff --git a/canaille/core/templates/reset-password.html b/canaille/templates/core/reset-password.html similarity index 100% rename from canaille/core/templates/reset-password.html rename to canaille/templates/core/reset-password.html diff --git a/canaille/core/templates/setup-2fa.html b/canaille/templates/core/setup-2fa.html similarity index 98% rename from canaille/core/templates/setup-2fa.html rename to canaille/templates/core/setup-2fa.html index a8a51012..ea535715 100644 --- a/canaille/core/templates/setup-2fa.html +++ b/canaille/templates/core/setup-2fa.html @@ -1,7 +1,7 @@ {% extends theme('base.html') %} {% import 'macro/flask.html' as flask %} {% import 'macro/form.html' as fui %} -{% import 'partial/login_field.html' as login_field %} +{% import 'core/partial/login_field.html' as login_field %} {% block container %}
diff --git a/canaille/core/templates/sms/sms_otp.txt b/canaille/templates/core/sms/sms_otp.txt similarity index 100% rename from canaille/core/templates/sms/sms_otp.txt rename to canaille/templates/core/sms/sms_otp.txt diff --git a/canaille/core/templates/users.html b/canaille/templates/core/users.html similarity index 95% rename from canaille/core/templates/users.html rename to canaille/templates/core/users.html index b9ecd6ff..07a60933 100644 --- a/canaille/core/templates/users.html +++ b/canaille/templates/core/users.html @@ -32,5 +32,5 @@ {{ table.search(table_form, "table.users") }}
- {% include "partial/users.html" %} + {% include "core/partial/users.html" %} {% endblock %} diff --git a/canaille/core/templates/verify-2fa.html b/canaille/templates/core/verify-2fa.html similarity index 98% rename from canaille/core/templates/verify-2fa.html rename to canaille/templates/core/verify-2fa.html index acb0f32b..c30aec12 100644 --- a/canaille/core/templates/verify-2fa.html +++ b/canaille/templates/core/verify-2fa.html @@ -1,7 +1,7 @@ {% extends theme('base.html') %} {% import 'macro/flask.html' as flask %} {% import 'macro/form.html' as fui %} -{% import 'partial/login_field.html' as login_field %} +{% import 'core/partial/login_field.html' as login_field %} {% block container %}
diff --git a/canaille/oidc/templates/authorization_list.html b/canaille/templates/oidc/authorization_list.html similarity index 95% rename from canaille/oidc/templates/authorization_list.html rename to canaille/templates/oidc/authorization_list.html index 86bdd21a..b93a4d9c 100644 --- a/canaille/oidc/templates/authorization_list.html +++ b/canaille/templates/oidc/authorization_list.html @@ -38,5 +38,5 @@ {{ table.search(table_form, "table.codes") }}
- {% include "partial/authorization_list.html" %} + {% include "oidc/partial/authorization_list.html" %} {% endblock %} diff --git a/canaille/oidc/templates/authorization_view.html b/canaille/templates/oidc/authorization_view.html similarity index 100% rename from canaille/oidc/templates/authorization_view.html rename to canaille/templates/oidc/authorization_view.html diff --git a/canaille/oidc/templates/authorize.html b/canaille/templates/oidc/authorize.html similarity index 100% rename from canaille/oidc/templates/authorize.html rename to canaille/templates/oidc/authorize.html diff --git a/canaille/oidc/templates/client_add.html b/canaille/templates/oidc/client_add.html similarity index 100% rename from canaille/oidc/templates/client_add.html rename to canaille/templates/oidc/client_add.html diff --git a/canaille/oidc/templates/client_edit.html b/canaille/templates/oidc/client_edit.html similarity index 100% rename from canaille/oidc/templates/client_edit.html rename to canaille/templates/oidc/client_edit.html diff --git a/canaille/oidc/templates/client_list.html b/canaille/templates/oidc/client_list.html similarity index 96% rename from canaille/oidc/templates/client_list.html rename to canaille/templates/oidc/client_list.html index 084d6bde..5adda636 100644 --- a/canaille/oidc/templates/client_list.html +++ b/canaille/templates/oidc/client_list.html @@ -38,5 +38,5 @@ {{ table.search(table_form, "table.clients") }}
- {% include "partial/client_list.html" %} + {% include "oidc/partial/client_list.html" %} {% endblock %} diff --git a/canaille/oidc/templates/consent_list.html b/canaille/templates/oidc/consent_list.html similarity index 100% rename from canaille/oidc/templates/consent_list.html rename to canaille/templates/oidc/consent_list.html diff --git a/canaille/oidc/templates/logout.html b/canaille/templates/oidc/logout.html similarity index 100% rename from canaille/oidc/templates/logout.html rename to canaille/templates/oidc/logout.html diff --git a/canaille/oidc/templates/modals/delete-client.html b/canaille/templates/oidc/modals/delete-client.html similarity index 100% rename from canaille/oidc/templates/modals/delete-client.html rename to canaille/templates/oidc/modals/delete-client.html diff --git a/canaille/oidc/templates/modals/revoke-token.html b/canaille/templates/oidc/modals/revoke-token.html similarity index 100% rename from canaille/oidc/templates/modals/revoke-token.html rename to canaille/templates/oidc/modals/revoke-token.html diff --git a/canaille/oidc/templates/partial/authorization_list.html b/canaille/templates/oidc/partial/authorization_list.html similarity index 100% rename from canaille/oidc/templates/partial/authorization_list.html rename to canaille/templates/oidc/partial/authorization_list.html diff --git a/canaille/oidc/templates/partial/client_list.html b/canaille/templates/oidc/partial/client_list.html similarity index 100% rename from canaille/oidc/templates/partial/client_list.html rename to canaille/templates/oidc/partial/client_list.html diff --git a/canaille/oidc/templates/partial/token_list.html b/canaille/templates/oidc/partial/token_list.html similarity index 100% rename from canaille/oidc/templates/partial/token_list.html rename to canaille/templates/oidc/partial/token_list.html diff --git a/canaille/oidc/templates/preconsent_list.html b/canaille/templates/oidc/preconsent_list.html similarity index 100% rename from canaille/oidc/templates/preconsent_list.html rename to canaille/templates/oidc/preconsent_list.html diff --git a/canaille/oidc/templates/token_list.html b/canaille/templates/oidc/token_list.html similarity index 96% rename from canaille/oidc/templates/token_list.html rename to canaille/templates/oidc/token_list.html index 57855f3e..9a5de7f9 100644 --- a/canaille/oidc/templates/token_list.html +++ b/canaille/templates/oidc/token_list.html @@ -38,5 +38,5 @@ {{ table.search(table_form, "table.tokens") }}
- {% include "partial/token_list.html" %} + {% include "oidc/partial/token_list.html" %} {% endblock %} diff --git a/canaille/oidc/templates/token_view.html b/canaille/templates/oidc/token_view.html similarity index 100% rename from canaille/oidc/templates/token_view.html rename to canaille/templates/oidc/token_view.html diff --git a/tests/oidc/test_client_admin.py b/tests/oidc/test_client_admin.py index c974be52..9fff9b9b 100644 --- a/tests/oidc/test_client_admin.py +++ b/tests/oidc/test_client_admin.py @@ -307,4 +307,4 @@ def test_client_new_token(testclient, logged_admin, backend, client): assert client in token.audience res = res.follow() - assert res.template == "token_view.html" + assert res.template == "oidc/token_view.html"