cannot delete default mailbox
This commit is contained in:
parent
2eae0ba4fd
commit
7febe6e15b
|
@ -43,11 +43,17 @@
|
||||||
🚫
|
🚫
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if mailbox.id == current_user.default_mailbox_id %}
|
||||||
|
<div class="badge badge-primary float-right" data-toggle="tooltip"
|
||||||
|
title="A random alias belongs to the default mailbox">Default Mailbox
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
<h6 class="card-subtitle mb-2 text-muted">
|
<h6 class="card-subtitle mb-2 text-muted">
|
||||||
Created {{ mailbox.created_at | dt }} <br>
|
Created {{ mailbox.created_at | dt }} <br>
|
||||||
<span class="font-weight-bold">{{ mailbox.nb_alias() }}</span> aliases. <br>
|
<span class="font-weight-bold">{{ mailbox.nb_alias() }}</span> aliases. <br>
|
||||||
|
|
||||||
</h6>
|
</h6>
|
||||||
|
|
||||||
<a href="{{ url_for('dashboard.mailbox_detail_route', mailbox_id=mailbox.id) }}">Edit ➡</a>
|
<a href="{{ url_for('dashboard.mailbox_detail_route', mailbox_id=mailbox.id) }}">Edit ➡</a>
|
||||||
|
@ -60,7 +66,8 @@
|
||||||
<input type="hidden" name="form-name" value="delete">
|
<input type="hidden" name="form-name" value="delete">
|
||||||
<input type="hidden" class="mailbox" value="{{ mailbox.email }}">
|
<input type="hidden" class="mailbox" value="{{ mailbox.email }}">
|
||||||
<input type="hidden" name="mailbox-id" value="{{ mailbox.id }}">
|
<input type="hidden" name="mailbox-id" value="{{ mailbox.id }}">
|
||||||
<span class="card-link btn btn-link text-danger float-right delete-mailbox">
|
<span class="card-link btn btn-link text-danger float-right delete-mailbox
|
||||||
|
{% if mailbox.id == current_user.default_mailbox_id %} disabled {% endif %}">
|
||||||
Delete
|
Delete
|
||||||
</span>
|
</span>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -44,6 +44,10 @@ def mailbox_route():
|
||||||
flash("Unknown error. Refresh the page", "warning")
|
flash("Unknown error. Refresh the page", "warning")
|
||||||
return redirect(url_for("dashboard.mailbox_route"))
|
return redirect(url_for("dashboard.mailbox_route"))
|
||||||
|
|
||||||
|
if mailbox.id == current_user.default_mailbox_id:
|
||||||
|
flash("You cannot delete default mailbox", "error")
|
||||||
|
return redirect(url_for("dashboard.mailbox_route"))
|
||||||
|
|
||||||
email = mailbox.email
|
email = mailbox.email
|
||||||
Mailbox.delete(mailbox_id)
|
Mailbox.delete(mailbox_id)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
Loading…
Reference in a new issue