enforce length limit for chud phrase in the backend

pull/142/head
Aevann 2023-03-19 20:17:44 +02:00
parent f329433443
commit f1a8db74b7
1 changed files with 6 additions and 2 deletions

View File

@ -306,9 +306,13 @@ def award_thing(v, thing_type, id):
else: author.agendaposter = int(time.time()) + 86400
agendaposter_phrase = request.values.get("agendaposter_phrase").lower()
if not agendaposter_phrase: abort(400)
if not agendaposter_phrase: abort(400, "Missing phrase!")
agendaposter_phrase = agendaposter_phrase.strip()
if not agendaposter_phrase: abort(400)
if not agendaposter_phrase: abort(400, "Missing phrase!")
if len(agendaposter_phrase) > 100:
abort(400, "Max length for phrase is 100 characters")
author.agendaposter_phrase = agendaposter_phrase