contentdb/app/templates/users/modtools.html
2023-12-29 10:38:27 +00:00

116 lines
4.0 KiB
HTML

{% extends "users/settings_base.html" %}
{% block title %}
{{ _("Moderator Tools") }}
{% endblock %}
{% block pane %}
<h2 class="mt-0">{{ _("Moderator Tools") }}</h2>
<h3>
{{ _("Storage") }}
</h3>
{% set all_releases = user.packages | map(attribute="releases") | flatten %}
{% set all_screenshots = user.packages | map(attribute="screenshots") | flatten %}
{% set release_size = ((all_releases | sum(attribute="file_size_bytes")) / 1048576) | round %}
{% set screenshot_size = ((all_screenshots | sum(attribute="file_size_bytes")) / 1048576) | round %}
<p>
{{ _("Total storage usage is %(total_size)d MB (releases %(release_size)d MB, screenshots %(screenshot_size)d MB).",
release_size=release_size, screenshot_size=screenshot_size, total_size=release_size + screenshot_size) }}
<br>
{{ _("%(releases)d releases and %(screenshots)d screenshots.",
releases=all_releases | length, screenshots=all_screenshots | length) }}
</p>
<h3>
{{ _("Edit Account") }}
</h3>
{% from "macros/forms.html" import render_field, render_field_prefix, render_submit_field %}
<form action="" method="POST" class="form" role="form">
{{ form.hidden_tag() }}
{% if user.check_perm(current_user, "CHANGE_USERNAMES") %}
{{ render_field(form.username, tabindex=230) }}
{{ render_field(form.display_name, tabindex=230) }}
{{ render_field(form.forums_username, tabindex=230) }}
{{ render_field_prefix(form.github_username, tabindex=230) }}
{% endif %}
{% if user.check_perm(current_user, "CHANGE_RANK") %}
{{ render_field(form.rank, tabindex=250) }}
{% endif %}
<p>
{{ render_submit_field(form.submit, tabindex=280) }}
</p>
</form>
<h3>{{ _("Password") }}</h3>
{% if user.password %}
<p>{{ _("Has password") }}</p>
{% else %}
<p class="text-danger">{{ _("Doesn't have password") }}</p>
{% endif %}
{% if not user.rank.at_least(current_user.rank) %}
<h3>{{ _("Ban") }}</h3>
{% if user.ban %}
<p>
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 mb-3">
<label for="message" class="form-label">{{ _("Message") }}</label>
<span class="ms-1 text-danger">
<small>
<i class="fas fa-asterisk"></i>
</small>
</span>
<span class="ms-3 text-muted">
{{ _("Required") }}
</span>
<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 mb-3">
<label for="expires_at" class="form-label">{{ _("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 %}
<h3>{{ _("Change Email and Send Password Reset") }}</h3>
<form method="POST" action="{{ url_for('users.modtools_set_email', username=user.username) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<div class="form-group mb-3">
<label for="email" class="form-label">{{ _("Email Address") }}</label>
<input type="email" class="form-control" name="email" id="email" value="{{ user.email or '' }}" />
</div>
<input type="submit" value="{{ _('Save') }}" class="btn btn-primary" />
</form>
{% endif %}
{% endblock %}