diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 5130c90a9..8e4b1abd2 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -12,7 +12,7 @@ marseyaward_body_regex = re.compile(">[^<\s+]|[^>\s+]<", flags=re.A) marseyaward_title_regex = re.compile("( *]+>)+", flags=re.A) -marsey_regex = re.compile("[a-z0-9]{1,30}", flags=re.A) +marsey_regex = re.compile("marsey[a-z0-9]{1,24}", flags=re.A) hat_regex = re.compile("[a-zA-Z0-9\-() ,_]{1,50}", flags=re.A) diff --git a/files/routes/static.py b/files/routes/static.py index 4a03a4b21..9addd72b3 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -492,13 +492,16 @@ def submit_marsey(v): @app.post("/admin/approve/marsey/") @admin_level_required(3) def approve_marsey(v, name): - if CARP_ID and v.id != CARP_ID: abort(403) + if CARP_ID and v.id != CARP_ID: + return {"error": "Only Carp can approve marseys!"} marsey = g.db.query(Marsey).filter_by(name=name).one_or_none() - if not marsey: abort(404) + if not marsey: + return {"error": f"This marsey `{name}` doesn't exist!"} tags = request.values.get('tags') - if not tags: abort(400) + if not tags: + return {"error": "You need to include tags!"} marsey.tags = tags g.db.add(marsey) @@ -528,10 +531,12 @@ def approve_marsey(v, name): @app.post("/admin/reject/marsey/") @admin_level_required(3) def reject_marsey(v, name): - if CARP_ID and v.id != CARP_ID: abort(403) + if CARP_ID and v.id != CARP_ID: + return {"error": "Only Carp can approve marseys!"} marsey = g.db.query(Marsey).filter_by(name=name).one_or_none() - if not marsey: abort(404) + if not marsey: + return {"error": f"This marsey `{name}` doesn't exist!"} msg = f'@{v.username} has rejected a marsey you submitted: `{marsey.name}`' send_repeatable_notification(marsey.submitter_id, msg) diff --git a/files/templates/submit_marseys.html b/files/templates/submit_marseys.html index 53ce1d8e1..55a3cd50b 100644 --- a/files/templates/submit_marseys.html +++ b/files/templates/submit_marseys.html @@ -31,7 +31,7 @@ - + @@ -118,7 +118,7 @@ } -

Current Applications

+

Pending Carp Approval