misuzu/templates/manage/users/user.twig
flashwave 383e2ed0e0 Rewrote the user information class.
This one took multiple days and it pretty invasive into the core of Misuzu so issue might (will) arise, there's also some features that have gone temporarily missing in the mean time and some inefficiencies introduced that will be fixed again at a later time.
The old class isn't gone entirely because I still have to figure out what I'm gonna do about validation, but for the most part this knocks out one of the "layers of backwards compatibility", as I've been referring to it, and is moving us closer to a future where Flashii actually gets real updates.
If you run into anything that's broken and you're inhibited from reporting it through the forum, do it through chat or mail me at flashii-issues@flash.moe.
2023-08-02 22:12:47 +00:00

203 lines
9.7 KiB
Twig

{% 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 }}">
{% 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 ~ ')') }}
{{ 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}) }}
</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')) }}
</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}) }}
</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) }}
</div>
</label>
{{ input_colour(can_edit_user ? 'colour[hex]' : '', '', user_info.colour) }}
</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">
{{ input_checkbox('roles[]', '', role.id in manage_user_has_roles, 'manage__tag__checkbox', role.id, false, null, not can_edit_user) }}
<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') }}
<div class="container__content">
<p>Links to various moderator tools to use on this user, provided you have access to them.</p>
</div>
<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 %}
</div>
</div>
{% if can_send_test_mail %}
<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 ~ ')') }}
<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 %}
{% if can_impersonate %}
<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 ~ ')') }}
<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>
{% 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 ~ ')') }}
{{ permissions_table(permissions, not can_edit_perms) }}
{% if can_edit_perms %}
{{ input_csrf() }}
<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 %}
</div>
{% endblock %}