|
@@ -372,10 +372,26 @@
|
|
|
Save
|
|
|
</a>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
</div>
|
|
|
|
|
|
+ {% if alias.mailbox_support_pgp() %}
|
|
|
+ <div class="small-text mt-2" data-toogle="tooltip"
|
|
|
+ title="You can decide to turn off the PGP for an alias. This can be useful if the sender already encrypts the emails">
|
|
|
+ PGP
|
|
|
+ <i class="fe fe-help-circle"></i>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <label class="custom-switch cursor pl-0">
|
|
|
+ <input type="checkbox" class="enable-disable-pgp custom-switch-input"
|
|
|
+ data-alias="{{ alias.id }}"
|
|
|
+ data-alias-email="{{ alias.email }}"
|
|
|
+ {{ "checked" if alias.pgp_enabled() else "" }}>
|
|
|
+
|
|
|
+ <span class="custom-switch-indicator"></span>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ {% endif %}
|
|
|
+
|
|
|
<div class="row mt-3">
|
|
|
<div class="col">
|
|
|
<form method="post">
|
|
@@ -563,6 +579,41 @@
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ $(".enable-disable-pgp").change(async function (e) {
|
|
|
+ let aliasId = $(this).data("alias");
|
|
|
+ let alias = $(this).data("alias-email");
|
|
|
+ var oldValue = !$(this).prop("checked");
|
|
|
+ let newValue = !oldValue;
|
|
|
+
|
|
|
+ try {
|
|
|
+ let res = await fetch(`/api/aliases/${aliasId}`, {
|
|
|
+ method: "PUT",
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ },
|
|
|
+ body: JSON.stringify({
|
|
|
+ disable_pgp: oldValue,
|
|
|
+ }),
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res.ok) {
|
|
|
+ if (newValue) {
|
|
|
+ toastr.success(`PGP is enabled for ${alias}`);
|
|
|
+ } else {
|
|
|
+ toastr.info(`PGP is disabled for ${alias}`);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ toastr.error("Sorry for the inconvenience! Could you refresh the page & retry please?", "Unknown Error");
|
|
|
+ // reset to the original value
|
|
|
+ $(this).prop("checked", oldValue);
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ toastr.error("Sorry for the inconvenience! Could you refresh the page & retry please?", "Unknown Error");
|
|
|
+ // reset to the original value
|
|
|
+ $(this).prop("checked", oldValue);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
$(".save-note").on("click", async function () {
|
|
|
let aliasId = $(this).data("alias");
|
|
|
let note = $(`#note-${aliasId}`).val();
|