From bb83300cb28b2d04f3e8c41a23fe64588091b960 Mon Sep 17 00:00:00 2001 From: Phil Edwards Date: Wed, 20 Sep 2023 00:29:21 -0400 Subject: [PATCH] Fix CSP problem with language picker on login/signup page --- kobo/apps/accounts/templates/account/base.html | 3 ++- static/js/language_dropdown.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 static/js/language_dropdown.js diff --git a/kobo/apps/accounts/templates/account/base.html b/kobo/apps/accounts/templates/account/base.html index 8d6420db6a..506da954ed 100644 --- a/kobo/apps/accounts/templates/account/base.html +++ b/kobo/apps/accounts/templates/account/base.html @@ -31,7 +31,7 @@ - {% get_current_language as LANGUAGE_CODE %} {% get_available_languages as LANGUAGES %} {% get_language_info_list for LANGUAGES as languages %} @@ -47,6 +47,7 @@ + {% endblock %} {% block content %} diff --git a/static/js/language_dropdown.js b/static/js/language_dropdown.js new file mode 100644 index 0000000000..8657644857 --- /dev/null +++ b/static/js/language_dropdown.js @@ -0,0 +1,4 @@ +// Submit language form when the language dropdown changes +document.querySelector('select[name="language"]').onchange = function () { + this.form.submit(); +};