check that language is in the supported list

fix #970
This commit is contained in:
Glandos 2021-12-21 22:30:43 +01:00
parent f4c5786597
commit 190c11c184

View file

@ -818,8 +818,11 @@ def edit_bill(bill_id):
@main.route("/lang/<lang>")
def change_lang(lang):
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"))