Implement wildcard aliases

This commit is contained in:
Lexi / Zoe 2022-01-02 03:05:40 +01:00
parent a01ddd9b22
commit 6400962a44
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
9 changed files with 141 additions and 25 deletions

View file

@ -71,13 +71,21 @@
<table class="bordered_table">
<tr>
<th></th>
<th>Address</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 %}
@ -95,7 +103,18 @@
<tr>
<td><label for="add_alias_address">New alias:</label></td>
<td>
<input id="add_alias_address" name="alias_address" value="{{ formData['new_alias'] | default('') }}" {{ success is defined or error is defined ? 'autofocus': '' }}/>
<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>
@ -104,5 +123,18 @@
</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 %}