diff --git a/app/api/views/auth_mfa.py b/app/api/views/auth_mfa.py index abb686ac..c53a0b9c 100644 --- a/app/api/views/auth_mfa.py +++ b/app/api/views/auth_mfa.py @@ -38,7 +38,7 @@ def auth_mfa(): s = Signer(FLASK_SECRET) try: user_id = int(s.unsign(mfa_key)) - except BadSignature: + except Exception: return jsonify(error="Invalid mfa_key"), 400 user = User.get(user_id) diff --git a/app/config.py b/app/config.py index 41ac6c3c..a47a7994 100644 --- a/app/config.py +++ b/app/config.py @@ -1,5 +1,8 @@ import os +import random +import string import subprocess +import tempfile from uuid import uuid4 from dotenv import load_dotenv @@ -156,6 +159,17 @@ WORDS_FILE_PATH = get_abs_path( os.environ.get("WORDS_FILE_PATH", "local_data/words_alpha.txt") ) +# Used to generate random email +if os.environ.get("GNUPGHOME"): + GNUPGHOME = get_abs_path(os.environ.get("GNUPGHOME")) +else: + letters = string.ascii_lowercase + random_dir_name = "".join(random.choice(letters) for _ in range(20)) + GNUPGHOME = f"/tmp/{random_dir_name}" + if not os.path.exists(GNUPGHOME): + os.mkdir(GNUPGHOME, mode=0o700) + + print("WARNING: Use a temp directory for GNUPGHOME", GNUPGHOME) # Github, Google, Facebook client id and secrets GITHUB_CLIENT_ID = os.environ.get("GITHUB_CLIENT_ID") diff --git a/app/dashboard/templates/dashboard/mailbox.html b/app/dashboard/templates/dashboard/mailbox.html index 639fd95a..ca32fffc 100644 --- a/app/dashboard/templates/dashboard/mailbox.html +++ b/app/dashboard/templates/dashboard/mailbox.html @@ -41,6 +41,10 @@ 🚫 {% endif %} + {% if mailbox.pgp_finger_print %} + 🗝 + {% endif %} + {% if mailbox.id == current_user.default_mailbox_id %}