2020-01-08 21:38:01 +01:00
|
|
|
|
{% extends 'default.html' %}
|
|
|
|
|
{% set active_page = "directory" %}
|
|
|
|
|
|
|
|
|
|
{% block title %}
|
|
|
|
|
Directory
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{% block default_content %}
|
|
|
|
|
<div class="row">
|
2020-04-05 19:59:48 +02:00
|
|
|
|
<div class="col">
|
2020-05-03 10:47:29 +02:00
|
|
|
|
<h1 class="h3"> Directories
|
|
|
|
|
<a class="ml-3 text-info" style="font-size: 12px" data-toggle="collapse" href="#howtouse" role="button"
|
|
|
|
|
aria-expanded="false" aria-controls="collapseExample">
|
|
|
|
|
How to use <i class="fe fe-chevrons-down"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</h1>
|
|
|
|
|
|
2020-01-08 21:38:01 +01:00
|
|
|
|
|
2020-01-16 22:21:19 +01:00
|
|
|
|
{% if not current_user.is_premium() %}
|
2020-01-19 22:06:36 +01:00
|
|
|
|
<div class="alert alert-danger" role="alert">
|
|
|
|
|
This feature is only available in premium plan.
|
|
|
|
|
</div>
|
2020-01-16 22:21:19 +01:00
|
|
|
|
{% endif %}
|
|
|
|
|
|
2021-04-06 18:10:32 +02:00
|
|
|
|
<div class="alert alert-primary collapse {% if not dirs %} show {% endif %}" id="howtouse" role="alert">
|
2020-04-15 22:52:30 +02:00
|
|
|
|
<div>
|
|
|
|
|
Directory allows you to create aliases <b>on the fly</b>.
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mt-2 pb-2">
|
2020-05-24 23:55:49 +02:00
|
|
|
|
1️⃣ Pick a name for your directory, says <em>my_directory</em> <br>
|
2020-04-15 22:52:30 +02:00
|
|
|
|
|
2020-05-03 10:47:29 +02:00
|
|
|
|
2️⃣ Quickly use one of the following formats to create an alias on-the-fly <b>without creating this alias
|
|
|
|
|
beforehand</b>
|
2020-04-15 22:52:30 +02:00
|
|
|
|
</div>
|
2020-05-11 23:22:06 +02:00
|
|
|
|
<div class="pl-3 py-2 bg-secondary">
|
2020-05-24 23:55:49 +02:00
|
|
|
|
<em>my_directory/<b>anything</b>@{{ FIRST_ALIAS_DOMAIN }}</em> or <br>
|
|
|
|
|
<em>my_directory+<b>anything</b>@{{ FIRST_ALIAS_DOMAIN }}</em> or <br>
|
|
|
|
|
<em>my_directory#<b>anything</b>@{{ FIRST_ALIAS_DOMAIN }}</em> <br>
|
2020-04-15 22:52:30 +02:00
|
|
|
|
</div>
|
2021-09-21 14:08:52 +02:00
|
|
|
|
<em><b>anything</b></em> is any string composed of lowercase characters. <br>
|
2020-05-24 23:55:49 +02:00
|
|
|
|
|
|
|
|
|
You can find more info on directory on our <a href="https://simplelogin.io/blog/alias-directory/">blog post</a>.
|
2020-04-15 22:52:30 +02:00
|
|
|
|
|
|
|
|
|
<div class="mt-2">
|
|
|
|
|
You can use this feature on the following domains:
|
|
|
|
|
{% for alias_domain in ALIAS_DOMAINS %}
|
|
|
|
|
<div class="font-weight-bold">{{ alias_domain }} </div>
|
|
|
|
|
{% endfor %}
|
2020-01-19 22:06:36 +01:00
|
|
|
|
</div>
|
2020-01-19 22:34:31 +01:00
|
|
|
|
|
|
|
|
|
<div class="h4 text-primary mt-3">
|
|
|
|
|
ℹ️
|
|
|
|
|
The alias will be created the first time it receives an email.
|
|
|
|
|
</div>
|
|
|
|
|
|
2020-01-08 21:38:01 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
2020-05-03 10:48:21 +02:00
|
|
|
|
<div class="row">
|
|
|
|
|
{% for dir in dirs %}
|
|
|
|
|
<div class="col-12 col-lg-6">
|
|
|
|
|
<div class="card" style="">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<h5 class="card-title">
|
2020-12-07 10:49:40 +01:00
|
|
|
|
<div class="d-flex">
|
|
|
|
|
{{ dir.name }}
|
|
|
|
|
|
|
|
|
|
<form method="post">
|
|
|
|
|
<input type="hidden" name="form-name" value="toggle-directory">
|
|
|
|
|
<input type="hidden" name="dir-id" value="{{ dir.id }}">
|
|
|
|
|
|
|
|
|
|
<label class="custom-switch cursor" style="padding-left: 1rem"
|
|
|
|
|
data-toggle="tooltip"
|
|
|
|
|
{% if dir.disabled %}
|
|
|
|
|
title="Enable directory on-the-fly alias creation"
|
|
|
|
|
{% else %}
|
|
|
|
|
title="Disable directory on-the-fly alias creation"
|
|
|
|
|
{% endif %}
|
|
|
|
|
>
|
|
|
|
|
<input type="checkbox" class="custom-switch-input" name="dir-status"
|
|
|
|
|
{{ "" if dir.disabled else "checked" }}>
|
|
|
|
|
<span class="custom-switch-indicator"></span>
|
|
|
|
|
</label>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
2020-05-03 10:48:21 +02:00
|
|
|
|
</h5>
|
2020-12-07 10:49:40 +01:00
|
|
|
|
|
2020-05-03 10:48:21 +02:00
|
|
|
|
<h6 class="card-subtitle mb-2 text-muted">
|
2020-12-07 10:49:40 +01:00
|
|
|
|
{% if dir.disabled %}
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
⚠️ On-the-fly alias creation is disabled, you can't create new aliases with this directory.
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
2020-05-03 10:48:21 +02:00
|
|
|
|
Created {{ dir.created_at | dt }} <br>
|
|
|
|
|
<span class="font-weight-bold">{{ dir.nb_alias() }}</span> aliases.
|
2020-06-05 22:13:35 +02:00
|
|
|
|
|
|
|
|
|
<br><br>
|
|
|
|
|
|
|
|
|
|
<b>Mailboxes:</b> <i class="fe fe-info" data-toggle="tooltip"
|
|
|
|
|
title="Aliases created with this directory are automatically owned by these mailboxes"></i>
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
{% set dir_mailboxes=dir.mailboxes %}
|
|
|
|
|
<form method="post" class="mt-2">
|
|
|
|
|
<input type="hidden" name="form-name" value="update">
|
|
|
|
|
<input type="hidden" name="dir-id" value="{{ dir.id }}">
|
|
|
|
|
|
|
|
|
|
<select data-width="100%" required
|
|
|
|
|
class="mailbox-select" multiple name="mailbox_ids">
|
|
|
|
|
{% for mailbox in mailboxes %}
|
|
|
|
|
<option value="{{ mailbox.id }}" {% if mailbox in dir_mailboxes %}
|
|
|
|
|
selected {% endif %}>
|
|
|
|
|
{{ mailbox.email }}
|
|
|
|
|
</option>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</select>
|
|
|
|
|
<button class="mt-2 btn btn-outline-primary btn-sm">Update</button>
|
|
|
|
|
</form>
|
2020-05-03 10:48:21 +02:00
|
|
|
|
</h6>
|
|
|
|
|
</div>
|
2020-01-08 21:38:01 +01:00
|
|
|
|
|
2020-05-03 10:48:21 +02:00
|
|
|
|
<div class="card-footer p-0">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col">
|
|
|
|
|
<form method="post">
|
|
|
|
|
<input type="hidden" name="form-name" value="delete">
|
|
|
|
|
<input type="hidden" class="dir-name" value="{{ dir.name }}">
|
|
|
|
|
<input type="hidden" name="dir-id" value="{{ dir.id }}">
|
|
|
|
|
<span class="card-link btn btn-link float-right text-danger delete-dir">
|
2020-01-08 21:38:01 +01:00
|
|
|
|
Delete
|
|
|
|
|
</span>
|
2020-05-03 10:48:21 +02:00
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2020-01-08 21:38:01 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
2020-05-03 10:48:21 +02:00
|
|
|
|
</div>
|
2020-01-08 21:38:01 +01:00
|
|
|
|
</div>
|
2020-05-03 10:48:21 +02:00
|
|
|
|
{% endfor %}
|
|
|
|
|
</div>
|
2020-01-08 21:38:01 +01:00
|
|
|
|
|
2021-11-18 10:33:15 +01:00
|
|
|
|
<div class="row {% if current_user.directory_quota <= 0 %} disabled-content {% endif %}">
|
2020-06-05 23:25:37 +02:00
|
|
|
|
<div class="col">
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
|
|
|
|
|
<form method="post" class="mt-2">
|
|
|
|
|
{{ new_dir_form.csrf_token }}
|
|
|
|
|
<input type="hidden" name="form-name" value="create">
|
2020-01-08 21:38:01 +01:00
|
|
|
|
|
2021-11-18 10:33:15 +01:00
|
|
|
|
<h2 class="h4 mb-1">New Directory</h2>
|
|
|
|
|
<div class="small-text mb-4">
|
|
|
|
|
You can create up to {{ current_user.directory_quota }} directories.
|
|
|
|
|
</div>
|
2020-01-08 21:38:01 +01:00
|
|
|
|
|
2020-06-05 23:25:37 +02:00
|
|
|
|
{{ new_dir_form.name(class="form-control", placeholder="my-directory",
|
2020-01-09 20:43:03 +01:00
|
|
|
|
pattern="[0-9a-z-_]{3,}",
|
2020-02-23 09:10:59 +01:00
|
|
|
|
title="Only letter, number, dash (-), underscore (_) can be used. Directory name must be at least 3 characters.") }}
|
2020-06-05 23:25:37 +02:00
|
|
|
|
{{ render_field_errors(new_dir_form.name) }}
|
|
|
|
|
<div class="small-text">
|
|
|
|
|
Directory name must be at least 3 characters.
|
|
|
|
|
Only lowercase letters, numbers, dashes (-) and underscores (_) are currently supported.
|
|
|
|
|
</div>
|
2020-05-03 10:48:21 +02:00
|
|
|
|
|
2020-06-05 23:25:37 +02:00
|
|
|
|
<div class="mt-3 small-text alert alert-info">
|
|
|
|
|
By default, aliases created with directory are "owned" by your default
|
|
|
|
|
mailbox <b>{{ current_user.default_mailbox.email }}</b>. <br>
|
|
|
|
|
You can however choose the mailbox(es) that new alias automatically belongs to by setting this below
|
|
|
|
|
option.
|
2020-06-05 22:10:52 +02:00
|
|
|
|
|
2020-06-05 23:25:37 +02:00
|
|
|
|
</div>
|
2020-06-05 22:10:52 +02:00
|
|
|
|
|
2020-06-05 23:25:37 +02:00
|
|
|
|
<select data-width="100%"
|
|
|
|
|
class="mailbox-select" multiple name="mailbox_ids">
|
|
|
|
|
{% for mailbox in mailboxes %}
|
|
|
|
|
<option value="{{ mailbox.id }}" {% if mailbox.id == current_user.default_mailbox_id %}
|
|
|
|
|
selected {% endif %}>
|
|
|
|
|
{{ mailbox.email }}
|
|
|
|
|
</option>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</select>
|
2020-06-05 22:10:52 +02:00
|
|
|
|
|
2021-05-25 18:30:14 +02:00
|
|
|
|
<button id="btn-create-directory" class="btn btn-primary mt-2">Create</button>
|
2020-06-05 23:25:37 +02:00
|
|
|
|
</form>
|
2020-01-08 21:38:01 +01:00
|
|
|
|
|
2020-06-05 23:25:37 +02:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-01-08 21:38:01 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{% block script %}
|
|
|
|
|
<script>
|
|
|
|
|
$(".delete-dir").on("click", function (e) {
|
|
|
|
|
let directory = $(this).parent().find(".dir-name").val();
|
2020-04-30 22:37:39 +02:00
|
|
|
|
|
|
|
|
|
let that = $(this);
|
2021-11-18 10:33:15 +01:00
|
|
|
|
let message = `All aliases associated with <b>${directory}</b> directory will also be deleted. ` +
|
2021-11-20 20:01:36 +01:00
|
|
|
|
`As a deleted directory can't be used by someone else, deleting a directory doesn't reset your directory quota. ` +
|
|
|
|
|
`Your directory quota will be {{ current_user.directory_quota }} after the deletion, ` +
|
2020-05-03 10:48:21 +02:00
|
|
|
|
" please confirm.";
|
2020-04-30 22:37:39 +02:00
|
|
|
|
|
|
|
|
|
bootbox.confirm({
|
|
|
|
|
message: message,
|
|
|
|
|
buttons: {
|
|
|
|
|
confirm: {
|
|
|
|
|
label: 'Yes, delete it',
|
|
|
|
|
className: 'btn-danger'
|
|
|
|
|
},
|
|
|
|
|
cancel: {
|
|
|
|
|
label: 'Cancel',
|
|
|
|
|
className: 'btn-outline-primary'
|
|
|
|
|
}
|
2020-01-08 21:38:01 +01:00
|
|
|
|
},
|
2020-04-30 22:37:39 +02:00
|
|
|
|
callback: function (result) {
|
|
|
|
|
if (result) {
|
|
|
|
|
that.closest("form").submit();
|
|
|
|
|
}
|
2020-01-08 21:38:01 +01:00
|
|
|
|
}
|
2020-04-30 22:37:39 +02:00
|
|
|
|
})
|
|
|
|
|
|
2020-01-08 21:38:01 +01:00
|
|
|
|
});
|
2020-06-05 22:10:52 +02:00
|
|
|
|
|
|
|
|
|
$('.mailbox-select').multipleSelect();
|
|
|
|
|
|
2020-12-07 10:49:40 +01:00
|
|
|
|
$(".custom-switch-input").change(function (e) {
|
|
|
|
|
$(this).closest("form").submit();
|
|
|
|
|
});
|
|
|
|
|
|
2020-01-08 21:38:01 +01:00
|
|
|
|
</script>
|
2020-05-27 22:52:45 +02:00
|
|
|
|
{% endblock %}
|