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 -->
|
||||
{% if current_user.can_use_pgp %}
|
||||
<div class="card">
|
||||
<form method="post">
|
||||
<input type="hidden" name="form-name" value="pgp">
|
||||
|
@ -82,6 +83,7 @@
|
|||
</form>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- END PGP Public key -->
|
||||
|
||||
</div>
|
||||
|
|
|
@ -95,6 +95,12 @@ def mailbox_detail_route(mailbox_id):
|
|||
url_for("dashboard.mailbox_detail_route", mailbox_id=mailbox_id)
|
||||
)
|
||||
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":
|
||||
mailbox.pgp_public_key = request.form.get("pgp")
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue