misuzu/templates/manage/users/user.twig

204 lines
9.7 KiB
Twig
Raw Normal View History

2022-09-13 13:14:49 +00:00
{% extends 'manage/users/master.twig' %}
{% from 'macros.twig' import container_title %}
{% from 'manage/macros.twig' import permissions_table %}
{% from '_layout/input.twig' import input_csrf, input_text, input_checkbox, input_file, input_select, input_colour, input_hidden %}
{% set site_link = url('user-profile', {'user': user_info.id}) %}
{% block manage_content %}
<div class="manage__user" style="--accent-colour: {{ user_info.colour }}">
2022-09-13 13:14:49 +00:00
{% if manage_notices|length > 0 %}
<div class="warning">
<div class="warning__content">
{% for notice in manage_notices %}
<p>{{ notice }}</p>
{% endfor %}
</div>
</div>
{% endif %}
<form method="post" action="{{ url('manage-user', {'user': user_info.id}) }}" class="container manage__user__container">
{{ container_title('Editing ' ~ user_info.name ~ ' (' ~ user_info.id ~ ')') }}
2022-09-13 13:14:49 +00:00
{{ input_csrf() }}
<div class="manage__user__details">
<label class="form__label">
<div class="form__label__text">Username</div>
<div class="form__label__input">
{{ input_text(can_edit_user ? 'user[username]' : '', 'manage__user__input', user_info.name, 'text', '', true, {'maxlength':16}) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">E-mail address</div>
<div class="form__label__input">
{{ input_text(can_edit_user ? 'user[email]' : '', 'manage__user__input', user_info.emailAddress, 'text', '', true, {'maxlength':255}) }}
</div>
</label>
<label class="form__label">
<div class="form__label__text">Title</div>
<div class="form__label__input">
{{ input_text(can_edit_user ? 'user[title]' : '', 'manage__user__input', user_info.title, 'text', '', false, {'maxlength':64}) }}
</div>
</label>
<label class="form__label">
<div class="form__label__text">Joined</div>
<div class="form__label__input">
{{ input_text('', 'manage__user__input', user_info.createdTime|date('c')) }}
</div>
</label>
<label class="form__label">
<div class="form__label__text">Last online</div>
<div class="form__label__input">
{{ input_text('', 'manage__user__input', user_info.lastActiveTime|default(0)|date('c')) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Register IP</div>
<div class="form__label__input">
{{ input_text('', 'manage__user__input', user_info.registerRemoteAddress) }}
</div>
</label>
<label class="form__label">
<div class="form__label__text">Last IP</div>
<div class="form__label__input">
{{ input_text('', 'manage__user__input', user_info.lastRemoteAddress) }}
</div>
</label>
<label class="form__label">
<div class="form__label__text">Country</div>
<div class="form__label__input">
{{ input_text(can_edit_user ? 'user[country]' : '', 'manage__user__input', user_info.countryCode, 'text', 'XX', true, {'maxlength':2,'minlength':2}) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
{% if can_edit_user %}
<label class="form__label">
<div class="form__label__text">New Password</div>
<div class="form__label__input">
{{ input_text('password[new]', 'manage__user__input', '', 'password') }}
</div>
</label>
<label class="form__label">
<div class="form__label__text">Confirm Password</div>
<div class="form__label__input">
{{ input_text('password[confirm]', 'manage__user__input', '', 'password') }}
</div>
</label>
{% endif %}
</div>
<div class="manage__user__details">
<label class="form__label">
<div class="form__label__text">Custom Colour</div>
<div class="form__label__input">
{{ input_checkbox('colour[enable]', '', not user_info.colour.shouldInherit, '', '', false, null, not can_edit_user) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
{{ input_colour(can_edit_user ? 'colour[hex]' : '', '', user_info.colour) }}
2022-09-13 13:14:49 +00:00
</div>
<div class="manage__user__details">
<div class="manage__tags manage__tags--fixed">
{% for role in manage_roles %}
<label class="manage__tag" style="--accent-colour: {{ role.colour }}">
<div class="manage__tag__background"></div>
<div class="manage__tag__content">
2023-07-27 23:26:05 +00:00
{{ input_checkbox('roles[]', '', role.id in manage_user_has_roles, 'manage__tag__checkbox', role.id, false, null, not can_edit_user) }}
2022-09-13 13:14:49 +00:00
<div class="manage__tag__title">
{{ role.name }}
</div>
{{ input_checkbox('user[display_role]', '', role.id == user_info.displayRoleId, 'manage__tag__checkbox', role.id, true, null, not can_edit_user) }}
</div>
</label>
{% endfor %}
</div>
</div>
{% if can_edit_user %}
<div class="manage__user__buttons">
<button class="input__button manage__user__button">Save</button>
<button class="input__button manage__user__button" type="reset">Reset</button>
</div>
{% endif %}
</form>
<div class="container manage__user__container">
{{ container_title('Moderator tools') }}
2023-07-25 14:40:31 +00:00
<div class="container__content">
<p>Links to various moderator tools to use on this user, provided you have access to them.</p>
</div>
2023-07-25 14:40:31 +00:00
<div class="manage__user__buttons">
{% if can_manage_notes %}
<a href="{{ url('manage-users-notes', {'user': user_info.id}) }}" class="input__button manage__user__button"><i class="fas fa-sticky-note fa-fw"></i>&nbsp;Notes</a>
{% endif %}
{% if can_manage_warnings %}
<a href="{{ url('manage-users-warnings', {'user': user_info.id}) }}" class="input__button manage__user__button"><i class="fas fa-exclamation-circle fa-fw"></i>&nbsp;Warnings</a>
{% endif %}
{% if can_manage_bans %}
<a href="{{ url('manage-users-bans', {'user': user_info.id}) }}" class="input__button manage__user__button"><i class="fas fa-ban fa-fw"></i>&nbsp;Bans</a>
{% endif %}
2023-07-25 14:40:31 +00:00
</div>
</div>
2023-07-25 14:40:31 +00:00
{% if can_send_test_mail %}
2022-09-13 13:14:49 +00:00
<form method="post" action="{{ url('manage-user', {'user': user_info.id}) }}" class="container manage__user__container">
{{ container_title('Send test e-mail to ' ~ user_info.name ~ ' (' ~ user_info.id ~ ')') }}
2022-09-13 13:14:49 +00:00
<p style="font-size: 2em; line-height: 2em; text-align: center; font-weight: 700;">DO NOT ABUSE THIS SHIT</p>
{{ input_csrf() }}
{{ input_hidden('send_test_email', 'yes_send_it') }}
<div class="manage__user__buttons">
<button class="input__button manage__user__button">Send</button>
</div>
</form>
{% endif %}
2023-05-21 18:15:04 +00:00
{% if can_impersonate %}
2023-05-21 18:15:04 +00:00
<form method="post" action="{{ url('manage-user', {'user': user_info.id}) }}" class="container manage__user__container">
{{ container_title('Impersonate ' ~ user_info.name ~ ' (' ~ user_info.id ~ ')') }}
2023-05-21 18:15:04 +00:00
<div class="container__content">
<p>Uses a special token to completely impersonate this user for testing.</p>
</div>
{{ input_csrf() }}
{{ input_hidden('impersonate_user', 'meow') }}
<div class="manage__user__buttons">
<button class="input__button manage__user__button">Impersonate</button>
</div>
</form>
2022-09-13 13:14:49 +00:00
{% endif %}
{% if permissions is not empty %}
<form method="post" action="{{ url('manage-user', {'user': user_info.id}) }}" class="container manage__user__container">
{{ container_title('Permissions for ' ~ user_info.name ~ ' (' ~ user_info.id ~ ')') }}
2022-09-13 13:14:49 +00:00
{{ permissions_table(permissions, not can_edit_perms) }}
2022-09-13 13:14:49 +00:00
{% if can_edit_perms %}
{{ input_csrf() }}
2022-09-13 13:14:49 +00:00
<div class="manage__user__buttons">
<button class="input__button manage__user__button">Save</button>
<button class="input__button manage__user__button" type="reset">Reset</button>
</div>
{% endif %}
</form>
{% endif %}
2022-09-13 13:14:49 +00:00
</div>
{% endblock %}