Add temp banning and ban messages

This commit is contained in:
rubenwardy
2022-02-13 10:37:54 +00:00
parent 7a650eb1e4
commit 3d35f6507a
6 changed files with 144 additions and 18 deletions

View File

@@ -41,13 +41,37 @@
{% if not user.rank.atLeast(current_user.rank) %}
<h3>{{ _("Ban") }}</h3>
{% if user.rank.name == "BANNED" %}
{% if user.ban %}
<p>
Banned.
Banned by {{ user.ban.banned_by.display_name }} at {{ user.ban.created_at | full_datetime }}
{% if user.ban.expires_at %}
until {{ user.ban.expires_at | date }}
{% endif %}
</p>
<blockquote>
{{ user.ban.message }}
</blockquote>
<form method="POST" action="{{ url_for('users.modtools_unban', username=user.username) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" value="{{ _('Unban') }}" class="btn btn-primary" />
</form>
{% else %}
<form method="POST" action="{{ url_for('users.modtools_ban', username=user.username) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<div class="form-group">
<label for="message">{{ _("Message") }}</label>
<input id="message" class="form-control" type="text" name="message" required minlength="5">
<small class="form-text text-muted">
{{ _("Message to display to banned user") }}
</small>
</div>
<div class="form-group">
<label for="expires_at">{{ _("Expires At") }}</label>
<input id="expires_at" class="form-control" type="date" name="expires_at">
<small class="form-text text-muted">
{{ _("Expiry date. Leave blank for permanent ban") }}
</small>
</div>
<input type="submit" value="{{ _('Ban') }}" class="btn btn-danger" />
</form>
{% endif %}