mail-account-admin/templates/account_details.html.twig

141 lines
5.4 KiB
Twig

{% extends "base.html.twig" %}
{% block title %}View account{% endblock %}
{% block content %}
<h2>Account: {{ accountUsername }}</h2>
<p>
<b>Actions:</b>
<span>View</span> |
<a href="/accounts/{{ id }}/edit">Edit</a> |
<a href="/accounts/{{ id }}/delete">Delete</a> |
<a href="mailto:{{ accountUsername }}">Send mail</a>
</p>
<h3>View account details</h3>
<table class="bordered_table vertical_table_headers">
<tr>
<th style="min-width: 10em">User ID</th>
<td style="min-width: 20em">{{ account.getId() }}</td>
</tr>
<tr>
<th>Username</th>
<td>{{ account.getUsername() }}</td>
</tr>
<tr>
<th>Domain</th>
<td><a href="/accounts?domain={{ account.getDomain() | escape('url') }}">{{ account.getDomain() }}</a></td>
</tr>
<tr>
<th>Password</th>
<td>
{% if passwordHashType == 'empty' %}
<span class="red">[No password set]</span>
{% elseif passwordHashType == 'unknown' %}
<span class="red">[Not hashed / unknown hash algorithm]</span>
{% else %}
<span class="gray">[{{ passwordHashType }} hash]</span>
{% endif %}
</td>
</tr>
<tr>
<th>Status</th>
<td>{{ account.isActive() ? '<span class="green">Active</span>' : '<span class="red">Inactive</span>' }}</td>
</tr>
<tr>
<th>Home directory</th>
<td><span class="gray">/srv/vmail/</span>{{ account.getHomeDir() }}</td>
</tr>
<tr>
<th>Admin memo</th>
<td>{{ account.getMemo() | nl2br }}</td>
</tr>
<tr>
<th>Created at</th>
<td>{{ account.getCreatedAt() | date }}</td>
</tr>
<tr>
<th>Last modified at</th>
<td>{{ account.getModifiedAt() | date }}</td>
</tr>
</table>
<h3 id="aliases">Aliases</h3>
{{ include('includes/form_result_box.html.twig') }}
{% if aliases %}
<form action="/accounts/{{ id }}/deletealiases" method="POST">
<table class="bordered_table">
<tr>
<th></th>
<th style="min-width: 16em">Address</th>
<th>Wildcard (priority)</th>
<th>Created at</th>
</tr>
{% for alias in aliases %}
<tr>
<td><input type="checkbox" id="delete_selected_{{ alias.getId() }}" name="selected_aliases[]" value="{{ alias.getId() }}"/></td>
<td><label for="delete_selected_{{ alias.getId() }}">{{ alias.getMailAddress() }}</label></td>
<td>
{% if alias.isWildcard() %}
Yes ({{ alias.getWildcardPriority() }})
{% else %}
<span class="gray">No</span>
{% endif %}
</td>
<td>{{ alias.getCreatedAt() | date }}</td>
</tr>
{% endfor %}
</table>
<p>
<button type="submit">Delete selected aliases</button>
</p>
</form>
{% else %}
<p>No aliases.</p>
{% endif %}
<form action="/accounts/{{ id }}/addalias" method="POST">
<table class="margin_vertical_1rem">
<tr>
<td><label for="add_alias_address">New alias:</label></td>
<td>
<input id="add_alias_address" name="alias_address" value="{{ formData['alias_address'] | default('') }}" {{ success is defined or error is defined ? 'autofocus': '' }}/>
</td>
</tr>
<tr>
<td style="vertical-align: top">Wildcard:</td>
<td style="vertical-align: top">
<label>
<input type="checkbox" name="is_wildcard" {{ formData is defined and formData['is_wildcard'] | default() ? 'checked' : '' }}/>
Create wildcard alias,
</label>
<label for="add_alias_wildcard_priority">priority:</label>
<input type="number" id="add_alias_wildcard_priority" name="wildcard_priority" value="{{ formData['wildcard_priority'] | default('1') }}" style="width: 6em"/>
</td>
</tr>
<tr>
<td colspan="2">
<button type="submit">Add alias</button>
</td>
</tr>
</table>
<details>
<summary>How to define wildcard aliases?</summary>
<p>
Wildcard aliases use <code>%</code> as a placeholder for any amount of characters (zero or more),
e.g. <code>%@example.com</code> or <code>example-%@example.com</code>.
</p>
<p>
Additionally, a <b>wildcard priority</b> must be specified. When a mail address is looked up that
matches multiple (wildcard) aliases, the alias with the <b>lowest</b> wildcard priority will be used.
The priority must not be 0 (internally, the value 0 stands for regular non-wildcard aliases).
</p>
</details>
</form>
{% endblock %}