Check that language is in the supported list (#971)

This commit is contained in:
Glandos 2021-12-21 22:40:37 +01:00 committed by GitHub
parent f4c5786597
commit 8b6a2afc63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -818,8 +818,11 @@ def edit_bill(bill_id):
@main.route("/lang/<lang>")
def change_lang(lang):
session["lang"] = lang
session.update()
if lang in current_app.config["SUPPORTED_LANGUAGES"]:
session["lang"] = lang
session.update()
else:
flash(_(f"{lang} is not a supported language"), category="warning")
return redirect(request.headers.get("Referer") or url_for(".home"))