user can turn on/off pgp on mailbox that has valid pgp_finger_print
This commit is contained in:
parent
cbbb472d06
commit
3d75ef974a
|
@ -79,7 +79,29 @@
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
|
<div class="d-flex">
|
||||||
Pretty Good Privacy (PGP)
|
Pretty Good Privacy (PGP)
|
||||||
|
|
||||||
|
{% if mailbox.pgp_finger_print %}
|
||||||
|
<form method="post">
|
||||||
|
<input type="hidden" name="form-name" value="toggle-pgp">
|
||||||
|
|
||||||
|
<label class="custom-switch cursor" style="padding-left: 1rem"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
{% if mailbox.disable_pgp %}
|
||||||
|
title="Enable PGP"
|
||||||
|
{% else %}
|
||||||
|
title="Disable PGP"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<input type="checkbox" class="custom-switch-input" name="pgp-enabled"
|
||||||
|
{{ "" if mailbox.disable_pgp else "checked" }}>
|
||||||
|
<span class="custom-switch-indicator"></span>
|
||||||
|
</label>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="small-text mt-1">
|
<div class="small-text mt-1">
|
||||||
By importing your PGP Public Key into SimpleLogin, all emails sent to {{ mailbox.email }} are
|
By importing your PGP Public Key into SimpleLogin, all emails sent to {{ mailbox.email }} are
|
||||||
<b>encrypted</b> with your key. <br>
|
<b>encrypted</b> with your key. <br>
|
||||||
|
|
|
@ -146,14 +146,28 @@ def mailbox_detail_route(mailbox_id):
|
||||||
# Free user can decide to remove their added PGP key
|
# Free user can decide to remove their added PGP key
|
||||||
mailbox.pgp_public_key = None
|
mailbox.pgp_public_key = None
|
||||||
mailbox.pgp_finger_print = None
|
mailbox.pgp_finger_print = None
|
||||||
|
mailbox.disable_pgp = False
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash("Your PGP public key is removed successfully", "success")
|
flash("Your PGP public key is removed successfully", "success")
|
||||||
return redirect(
|
return redirect(
|
||||||
url_for("dashboard.mailbox_detail_route", mailbox_id=mailbox_id)
|
url_for("dashboard.mailbox_detail_route", mailbox_id=mailbox_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
elif request.form.get("form-name") == "toggle-pgp":
|
||||||
|
if request.form.get("pgp-enabled") == "on":
|
||||||
|
mailbox.disable_pgp = False
|
||||||
|
flash(f"PGP is enabled on {mailbox.email}", "success")
|
||||||
|
else:
|
||||||
|
mailbox.disable_pgp = True
|
||||||
|
flash(f"PGP is disabled on {mailbox.email}", "info")
|
||||||
|
|
||||||
|
db.session.commit()
|
||||||
|
return redirect(
|
||||||
|
url_for("dashboard.mailbox_detail_route", mailbox_id=mailbox_id)
|
||||||
|
)
|
||||||
elif request.form.get("form-name") == "generic-subject":
|
elif request.form.get("form-name") == "generic-subject":
|
||||||
if request.form.get("action") == "save":
|
if request.form.get("action") == "save":
|
||||||
if not mailbox.pgp_finger_print:
|
if not mailbox.pgp_enabled():
|
||||||
flash(
|
flash(
|
||||||
"Generic subject can only be used on PGP-enabled mailbox",
|
"Generic subject can only be used on PGP-enabled mailbox",
|
||||||
"error",
|
"error",
|
||||||
|
|
Loading…
Reference in a new issue