remotes/1693045480750635534/spooky-22
Aevann1 2021-08-03 14:25:47 +02:00
parent f700c9c3c8
commit 19e9fe8f31
2 changed files with 3 additions and 4 deletions

View File

@ -949,16 +949,15 @@ def admin_banned_domains(v):
banned_domains = g.db.query(BannedDomain).all()
return render_template("admin/banned_domains.html", v=v, banned_domains=banned_domains)
@app.post("/admin/ban_domain")
@app.post("/admin/toggle_ban_domain")
@admin_level_required(4)
@validate_formkey
def admin_ban_domain(v):
def admin_toggle_ban_domain(v):
domain=request.form.get("domain").strip()
if not domain: abort(400)
reason=request.form.get("reason", "").strip()
if not reason: abort(400)
d = g.db.query(BannedDomain).filter_by(domain=domain.replace("_","\_")).first()
if d: g.db.delete(d)

View File

@ -27,7 +27,7 @@
</table>
<form action="/admin/ban_domain" method="post">
<form action="/admin/toggle_ban_domain" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input name="domain" placeholder="Enter domain here.." class="form-control" required>
<input name="reason" placeholder="Enter ban reason here.." class="form-control">