master
Aevann1 2021-09-22 17:30:45 +02:00
parent cf823e0efd
commit 2c6eed250b
2 changed files with 13 additions and 8 deletions

View File

@ -846,9 +846,10 @@ def admin_title_change(user_id, v):
note=f'"{new_name}"'
)
g.db.add(ma)
g.db.commit()
return (redirect(user.url), user)
if 'redir' in request.values: return (redirect(user.url), user)
else: return {"message": f"@{user.username} was unbanned!"}
@app.post("/ban_user/<user_id>")
@admin_level_required(6)
@ -918,11 +919,11 @@ def ban_user(user_id, v):
comment = get_comment(comment)
comment.bannedfor = True
g.db.add(comment)
g.db.commit()
return {"message": f"@{user.username} was banned!"}
else:
g.db.commit()
return redirect(user.url)
g.db.commit()
if 'redir' in request.values: return (redirect(user.url), user)
else: return {"message": f"@{user.username} was banned!"}
@app.post("/unban_user/<user_id>")

View File

@ -289,6 +289,7 @@
{% if u.is_suspended %}
<form action="/unban_user/{{u.id}}/" method="post" action="">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="alts-1-desktop" class="custom-control-input" name="alts" value="1">
<label class="custom-control-label" for="alts-1-desktop">Include alts</label>
@ -298,6 +299,7 @@
{% else %}
<form action="/ban_user/{{u.id}}" method="post" action="">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit').disabled=false">
<input style="font-size:11px;" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
<div class="custom-control custom-checkbox">
@ -562,7 +564,8 @@
{% if u.is_suspended %}
<form action="/unban_user/{{u.id}}" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<br />
<input type="hidden" name="redir" value="true">
<br/>
<div class="custom-control custom-checkbox">
<input type="checkbox" id="alts-1-mobile" class="custom-control-input" name="alts" value="1">
<label class="custom-control-label" for="alts-1-mobile">Include alts</label>
@ -573,6 +576,7 @@
{% else %}
<form action="/ban_user/{{u.id}}/" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit2').disabled=false">
<input style="font-size:11px;" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
<br />