2019-07-06 23:25:52 +02:00
|
|
|
{% extends 'default.html' %}
|
|
|
|
|
|
|
|
{% set active_page = "dashboard" %}
|
|
|
|
|
|
|
|
{% block title %}
|
|
|
|
Custom Alias
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block default_content %}
|
2020-05-11 23:22:06 +02:00
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
|
|
<h1 class="h3">New Email Alias</h1>
|
2019-07-06 23:25:52 +02:00
|
|
|
|
2020-05-11 23:22:06 +02:00
|
|
|
{% if user_custom_domains|length == 0 and not DISABLE_ALIAS_SUFFIX %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col p-1">
|
|
|
|
<div class="alert alert-primary" role="alert">
|
|
|
|
You might notice a random word after the dot(<em>.</em>) in the alias.
|
|
|
|
This part is to avoid a person taking all the "nice" aliases like
|
|
|
|
<b>hello@{{ FIRST_ALIAS_DOMAIN }}</b>,
|
|
|
|
<b>me@{{ FIRST_ALIAS_DOMAIN }}</b>, etc. <br>
|
|
|
|
If you add your own domain, this restriction is removed and you can fully customize the alias. <br>
|
|
|
|
</div>
|
2020-02-18 05:59:03 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-11 23:22:06 +02:00
|
|
|
{% endif %}
|
2019-07-06 23:25:52 +02:00
|
|
|
|
2020-05-11 23:22:06 +02:00
|
|
|
<form method="post">
|
|
|
|
<div class="row mb-2">
|
|
|
|
<div class="col-sm-6 mb-1 p-1" style="min-width: 4em">
|
|
|
|
<input name="prefix" class="form-control"
|
2020-05-16 11:28:25 +02:00
|
|
|
id="prefix"
|
2020-05-11 23:22:06 +02:00
|
|
|
type="text"
|
|
|
|
pattern="[0-9a-z-_]{1,}"
|
|
|
|
title="Only lowercase letter, number, dash (-), underscore (_) can be used in alias prefix."
|
|
|
|
placeholder="email alias, for example newsletter-123_xyz"
|
|
|
|
autofocus required>
|
|
|
|
<div class="small-text">
|
|
|
|
Only lowercase letter, number, dash (-), underscore (_) can be used.
|
|
|
|
</div>
|
2020-02-18 05:54:35 +01:00
|
|
|
</div>
|
2019-12-06 10:28:00 +01:00
|
|
|
|
2019-12-23 16:09:20 +01:00
|
|
|
|
2020-05-11 23:22:06 +02:00
|
|
|
<div class="col-sm-6 p-1">
|
|
|
|
<select class="form-control" name="suffix">
|
|
|
|
{% for suffix in suffixes %}
|
|
|
|
<option value="{{ suffix[2] }}">
|
|
|
|
{% if suffix[0] %}
|
|
|
|
{{ suffix[1] }} (your domain)
|
|
|
|
{% else %}
|
|
|
|
{{ suffix[1] }}
|
|
|
|
{% endif %}
|
|
|
|
</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
2020-02-10 17:19:42 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-22 13:57:19 +01:00
|
|
|
|
2020-05-11 23:22:06 +02:00
|
|
|
<div class="row mb-2">
|
|
|
|
<div class="col p-1">
|
2020-05-16 11:28:25 +02:00
|
|
|
<select class="form-control custom-select selectpicker" id="mailboxes" multiple name="mailboxes">
|
2020-05-11 23:22:06 +02:00
|
|
|
{% for mailbox in mailboxes %}
|
2020-05-16 11:28:25 +02:00
|
|
|
<option value="{{ mailbox.id }}" {% if mailbox.id == current_user.default_mailbox_id %}
|
|
|
|
selected {% endif %}>
|
|
|
|
{{ mailbox.email }}
|
2020-05-11 23:22:06 +02:00
|
|
|
</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
<div class="small-text">
|
2020-05-16 11:28:25 +02:00
|
|
|
The mailbox(es) that owns this alias.
|
2020-05-11 23:22:06 +02:00
|
|
|
</div>
|
2020-02-10 17:19:42 +01:00
|
|
|
</div>
|
2020-02-05 11:36:06 +01:00
|
|
|
</div>
|
|
|
|
|
2020-05-11 23:22:06 +02:00
|
|
|
<div class="row mb-2">
|
|
|
|
<div class="col p-1">
|
2020-05-16 11:28:25 +02:00
|
|
|
<textarea name="note"
|
|
|
|
class="form-control"
|
|
|
|
rows="3"
|
|
|
|
placeholder="Note, can be anything to help you remember WHY you create this alias. This field is optional."></textarea>
|
2020-05-11 23:22:06 +02:00
|
|
|
</div>
|
2020-02-05 11:36:06 +01:00
|
|
|
</div>
|
|
|
|
|
2020-05-11 23:22:06 +02:00
|
|
|
<div class="row">
|
|
|
|
<div class="col p-1">
|
2020-05-16 11:28:25 +02:00
|
|
|
<span id="submit" class="btn btn-primary mt-1">Create</span>
|
2020-05-11 23:22:06 +02:00
|
|
|
</div>
|
2020-02-05 11:36:06 +01:00
|
|
|
</div>
|
2020-05-11 23:22:06 +02:00
|
|
|
</form>
|
|
|
|
</div>
|
2019-07-06 23:25:52 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{% endblock %}
|
|
|
|
|
2020-05-03 16:50:39 +02:00
|
|
|
{% block script %}
|
|
|
|
<script>
|
|
|
|
$("#submit").on("click", async function () {
|
|
|
|
let that = $(this);
|
|
|
|
let mailbox_ids = $(`#mailboxes`).val();
|
2020-05-10 15:21:31 +02:00
|
|
|
let prefix = $('#prefix').val();
|
2020-05-03 16:50:39 +02:00
|
|
|
|
|
|
|
if (mailbox_ids.length == 0) {
|
|
|
|
toastr.error("You must select at least a mailbox", "Error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-10 15:21:31 +02:00
|
|
|
if (!prefix) {
|
|
|
|
toastr.error("Alias cannot be empty", "Error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-03 16:50:39 +02:00
|
|
|
that.closest("form").submit();
|
|
|
|
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|
|
|
|
|