Skip to content

Commit

Permalink
Prevent proton mailboxes from enabling pgp encryption (#2086)
Browse files Browse the repository at this point in the history
  • Loading branch information
acasajus committed Apr 12, 2024
1 parent d5df91a commit 015036b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/auth/views/change_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

from app.auth.base import auth_bp
from app.db import Session
from app.extensions import limiter
from app.log import LOG
from app.models import EmailChange, ResetPasswordCode


@auth_bp.route("/change_email", methods=["GET", "POST"])
@limiter.limit("3/hour")
def change_email():
code = request.args.get("code")

Expand Down
11 changes: 9 additions & 2 deletions app/dashboard/views/mailbox_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,15 @@ def mailbox_detail_route(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")
if mailbox.is_proton():
mailbox.disable_pgp = True
flash(
"Enabling PGP for a Proton Mail mailbox is redundant and does not add any security benefit",
"info",
)
else:
mailbox.disable_pgp = False
flash(f"PGP is enabled on {mailbox.email}", "info")
else:
mailbox.disable_pgp = True
flash(f"PGP is disabled on {mailbox.email}", "info")
Expand Down

0 comments on commit 015036b

Please sign in to comment.