Accounts: Fetch list of all accounts (optionally filtered by domain)

This commit is contained in:
Lexi / Zoe 2021-07-30 03:46:43 +02:00
parent 279f4492e8
commit 985f46c652
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
6 changed files with 145 additions and 9 deletions

View file

@ -5,6 +5,48 @@
{% block content %}
<h2>Accounts</h2>
<p>List of accounts ... <b>TODO</b></p>
<p><a href="/accounts/42">Test</a></p>
<p>List of all mail accounts.</p>
<div class="filter_options">
<form action="/accounts" method="GET">
<h4>Filter:</h4>
<label for="filter_domain">Domain: </label>
<input name="domain" id="filter_domain" value="{{ filterDomain | default('') }}"/>
<button type="submit">Apply</button>
<button type="reset" onclick="location.href='/accounts'">Clear</button>
</form>
</div>
<input type="checkbox" id="show_details_checkbox"><label for="show_details_checkbox"> Show detail columns</label>
<table>
<tr>
<th style="min-width: 15em">Username</th>
<th style="min-width: 10em">Domain</th>
<th>Aliases</th>
<th>Active</th>
<th class="detail_column">Home directory</th>
<th class="detail_column" style="min-width: 10em">Memo</th>
<th>Created</th>
<th class="detail_column">Last modified</th>
</tr>
{% if accountList %}
{% for account in accountList -%}
<tr{% if account['is_active'] != 1 %} class="inactive"{% endif %}>
<td><a href="/accounts/{{ account['user_id'] }}">{{ account['username'] }}</a></td>
<td><a href="/accounts?domain={{ account['domain'] }}">{{ account['domain'] }}</a></td>
<td>{{ account['alias_count'] }}</td>
<td>{{ account['is_active'] == 1 ? 'Yes' : 'No' }}</td>
<td class="detail_column"><span class="gray">vmail/</span>{{ account['home_dir'] }}</td>
<td class="detail_column">{{ account['memo'] }}</td>
<td>{{ account['created_at'] }}</td>
<td class="detail_column">{{ account['modified_at'] }}</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="100" style="text-align: center">No accounts found.</td>
</tr>
{% endif %}
</table>
{% endblock %}