Skip to content

Commit

Permalink
Merge pull request #4647 from kobotoolbox/csp-language-dropdown
Browse files Browse the repository at this point in the history
Fix CSP problem with language picker on login/signup page
  • Loading branch information
noliveleger committed Sep 20, 2023
2 parents c472767 + bb83300 commit d124e85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kobo/apps/accounts/templates/account/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<input name="next" type="hidden" value="{{ redirect_to }}" />

<select name="language" onchange="this.form.submit()">
<select name="language">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
Expand All @@ -47,6 +47,7 @@

<input type="submit" value="Go" class="hidden" />
</form>
<script src="{% static 'js/language_dropdown.js' %}"></script>
{% endblock %}

{% block content %}
Expand Down
4 changes: 4 additions & 0 deletions static/js/language_dropdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Submit language form when the language dropdown changes
document.querySelector('select[name="language"]').onchange = function () {
this.form.submit();
};

0 comments on commit d124e85

Please sign in to comment.