Only user with can_use_pgp on can use GPG
This commit is contained in:
parent
afc5b6fe1a
commit
911c38710e
|
@ -57,6 +57,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- Change PGP Public key -->
|
<!-- Change PGP Public key -->
|
||||||
|
{% if current_user.can_use_pgp %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="form-name" value="pgp">
|
<input type="hidden" name="form-name" value="pgp">
|
||||||
|
@ -82,6 +83,7 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
<!-- END PGP Public key -->
|
<!-- END PGP Public key -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -95,6 +95,12 @@ def mailbox_detail_route(mailbox_id):
|
||||||
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") == "pgp":
|
elif request.form.get("form-name") == "pgp":
|
||||||
|
if not current_user.can_use_pgp:
|
||||||
|
flash("You cannot use PGP", "error")
|
||||||
|
return redirect(
|
||||||
|
url_for("dashboard.mailbox_detail_route", mailbox_id=mailbox_id)
|
||||||
|
)
|
||||||
|
|
||||||
if request.form.get("action") == "save":
|
if request.form.get("action") == "save":
|
||||||
mailbox.pgp_public_key = request.form.get("pgp")
|
mailbox.pgp_public_key = request.form.get("pgp")
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue