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-body">
|
||||
<div class="card-title">
|
||||
<div class="d-flex">
|
||||
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">
|
||||
By importing your PGP Public Key into SimpleLogin, all emails sent to {{ mailbox.email }} are
|
||||
<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
|
||||
mailbox.pgp_public_key = None
|
||||
mailbox.pgp_finger_print = None
|
||||
mailbox.disable_pgp = False
|
||||
db.session.commit()
|
||||
flash("Your PGP public key is removed successfully", "success")
|
||||
return redirect(
|
||||
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":
|
||||
if request.form.get("action") == "save":
|
||||
if not mailbox.pgp_finger_print:
|
||||
if not mailbox.pgp_enabled():
|
||||
flash(
|
||||
"Generic subject can only be used on PGP-enabled mailbox",
|
||||
"error",
|
||||
|
|
Loading…
Reference in a new issue