app/templates/dashboard/mailbox.html

157 lines
5.7 KiB
HTML
Raw Normal View History

2020-02-11 00:17:05 +08:00
{% extends 'default.html' %}
{% set active_page = "mailbox" %}
{% block title %}
Mailboxes
{% endblock %}
{% block default_content %}
<div class="row">
2020-04-06 01:59:48 +08:00
<div class="col">
<h1 class="h3"> Mailboxes
<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-02-11 00:17:05 +08:00
{% if not current_user.is_premium() %}
<div class="alert alert-danger" role="alert">
This feature is only available in premium plan.
</div>
{% endif %}
2021-04-07 00:10:32 +08:00
<div class="alert alert-primary collapse {% if mailboxes|length == 1 %} show {% endif %}" id="howtouse" role="alert">
2020-02-11 00:17:05 +08:00
A <em>mailbox</em> is just another personal email address. When creating a new alias, you could choose the
mailbox that <em>owns</em> this alias, i.e: <br>
- all emails sent to this alias will be forwarded to this mailbox <br>
2020-02-23 15:08:55 +08:00
- from this mailbox, you can reply/send emails from the alias. <br><br>
2020-02-11 00:17:05 +08:00
When you signed up, a mailbox is automatically created with your email <b>{{ current_user.email }}</b>
<br><br>
2020-02-11 00:17:05 +08:00
The mailbox doesn't have to be your email: it can be your friend's email
2020-02-23 15:08:55 +08:00
if you want to create aliases for your buddy.
2020-02-11 00:17:05 +08:00
</div>
<div class="row">
{% for mailbox in mailboxes %}
<div class="col-12 col-lg-6">
<div class="card">
<div class="card-body">
<h5 class="card-title">
{{ mailbox.email }}
{% if mailbox.verified %}
<span class="cursor" data-toggle="tooltip" data-original-title="Mailbox Verified"></span>
{% else %}
<span class="cursor" data-toggle="tooltip" data-original-title="Mailbox Not Verified">
2020-02-11 00:17:05 +08:00
🚫
</span>
{% endif %}
{% if mailbox.pgp_enabled() %}
<span class="cursor" data-toggle="tooltip" data-original-title="PGP Enabled">🗝</span>
{% endif %}
2020-02-23 16:41:53 +08:00
{% if mailbox.id == current_user.default_mailbox_id %}
<div class="badge badge-primary float-right" data-toggle="tooltip"
title="When a new random alias is created, it belongs to the default mailbox">Default Mailbox
</div>
{% endif %}
</h5>
2020-02-23 16:41:53 +08:00
<h6 class="card-subtitle mb-2 text-muted">
Created {{ mailbox.created_at | dt }} <br>
<span class="font-weight-bold">{{ mailbox.nb_alias() }}</span> aliases. <br>
2020-02-23 15:08:55 +08:00
</h6>
2020-02-11 00:17:05 +08:00
<a href="{{ url_for('dashboard.mailbox_detail_route', mailbox_id=mailbox.id) }}">Edit ➡</a>
</div>
<div class="card-footer p-0">
<div class="row">
{% if mailbox.verified %}
<div class="col">
<form method="post">
<input type="hidden" name="form-name" value="set-default">
<input type="hidden" class="mailbox" value="{{ mailbox.email }}">
<input type="hidden" name="mailbox-id" value="{{ mailbox.id }}">
<button class="card-link btn btn-link
2020-02-23 16:51:26 +08:00
{% if mailbox.id == current_user.default_mailbox_id %} disabled {% endif %}"
>
Set As Default Mailbox
</button>
</form>
</div>
{% endif %}
<div class="col">
<form method="post">
<input type="hidden" name="form-name" value="delete">
<input type="hidden" class="mailbox" value="{{ mailbox.email }}">
<input type="hidden" name="mailbox-id" value="{{ mailbox.id }}">
<span class="card-link btn btn-link text-danger float-right delete-mailbox
2020-02-23 16:41:53 +08:00
{% if mailbox.id == current_user.default_mailbox_id %} disabled {% endif %}">
2020-02-11 00:17:05 +08:00
Delete
</span>
</form>
</div>
</div>
2020-02-11 00:17:05 +08:00
</div>
</div>
2020-02-11 00:17:05 +08:00
</div>
{% endfor %}
</div>
2020-02-11 00:17:05 +08:00
<form method="post" class="mt-2">
2020-02-11 00:17:05 +08:00
{{ new_mailbox_form.csrf_token }}
<input type="hidden" name="form-name" value="create">
<h2 class="h4">New Mailbox</h2>
2020-02-11 00:17:05 +08:00
{{ new_mailbox_form.email(class="form-control", placeholder="email@example.com") }}
2020-02-11 00:17:05 +08:00
{{ render_field_errors(new_mailbox_form.email) }}
<div class="small-text">
2021-03-18 17:59:45 +08:00
A mailbox can't be a disposable or forwarding email address.
</div>
2021-05-26 00:30:14 +08:00
<button class="btn btn-primary mt-2">Create</button>
2020-02-11 00:17:05 +08:00
</form>
</div>
</div>
{% endblock %}
{% block script %}
<script>
$(".delete-mailbox").on("click", function (e) {
let mailbox = $(this).parent().find(".mailbox").val();
2020-05-01 04:37:39 +08:00
let that = $(this);
let message = `All aliases owned by this mailbox <b>${mailbox}</b> will be also deleted, ` +
" please confirm.";
2020-05-01 04:37:39 +08:00
bootbox.confirm({
message: message,
buttons: {
confirm: {
label: 'Yes, delete it',
className: 'btn-danger'
},
cancel: {
label: 'Cancel',
className: 'btn-outline-primary'
}
2020-02-11 00:17:05 +08:00
},
2020-05-01 04:37:39 +08:00
callback: function (result) {
if (result) {
that.closest("form").submit();
}
2020-02-11 00:17:05 +08:00
}
2020-05-01 04:37:39 +08:00
})
2020-02-11 00:17:05 +08:00
});
</script>
{% endblock %}