contentdb/app/templates/users/modtools.html

129 lines
4.3 KiB
HTML
Raw Normal View History

2022-01-21 23:23:24 +01:00
{% 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>
2022-01-21 23:23:24 +01:00
<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") %}
2022-01-21 23:23:24 +01:00
{{ 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") %}
2022-01-21 23:23:24 +01:00
{{ 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 %}
2023-06-19 22:27:49 +02:00
{% if not user.rank.at_least(current_user.rank) %}
2022-01-21 23:23:24 +01:00
<h3>{{ _("Ban") }}</h3>
2022-02-13 11:37:54 +01:00
{% if user.ban %}
2022-01-21 23:23:24 +01:00
<p>
2022-02-13 11:37:54 +01:00
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 %}
2022-01-21 23:23:24 +01:00
</p>
2022-02-13 11:37:54 +01:00
<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>
2022-01-21 23:23:24 +01:00
{% else %}
<form method="POST" action="{{ url_for('users.modtools_ban', username=user.username) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
2023-08-22 20:58:43 +02:00
<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>
2023-08-22 20:58:43 +02:00
<span class="ms-3 text-muted">
{{ _("Required") }}
</span>
2022-02-13 11:37:54 +01:00
<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>
2023-08-22 20:58:43 +02:00
<div class="form-group mb-3">
<label for="expires_at" class="form-label">{{ _("Expires At") }}</label>
2022-02-13 11:37:54 +01:00
<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>
2022-01-21 23:23:24 +01:00
<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() }}" />
2023-08-22 20:58:43 +02:00
<div class="form-group mb-3">
<label for="email" class="form-label">{{ _("Email Address") }}</label>
2022-01-21 23:23:24 +01:00
<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 %}
<h3>{{ _("Pending email verifications") }}</h3>
<ul>
{% for ver in user.email_verifications %}
{% if not ver.is_expired %}
<li>
2024-07-05 02:19:33 +02:00
{{ ver.email }}, {{ ver.created_at | full_datetime }}:
<a href="{{ url_for('users.verify_email', token=ver.token) }}">verify</a>
</li>
{% endif %}
{% endfor %}
</ul>
2022-01-21 23:23:24 +01:00
{% endblock %}