ソースを参照

remove support for directory+anything@EMAIL_DOMAIN

Son NK 5 年 前
コミット
ecce1eff99

+ 0 - 1
app/dashboard/templates/dashboard/directory.html

@@ -13,7 +13,6 @@
       <div class="alert alert-primary" role="alert">
         Directory allows you to create aliases <b>on the fly</b>. <br>
         Simply use <em>directory/<b>anything</b>@{{ EMAIL_DOMAIN }}</em>
-        or <em>directory+<b>anything</b>@{{ EMAIL_DOMAIN }}</em>
         next time you need an email address. <br>
         The alias will be created the first time it receives an email.
       </div>

+ 0 - 6
app/dashboard/views/directory.py

@@ -52,12 +52,6 @@ def directory():
 
                 if Directory.get_by(name=new_dir_name):
                     flash(f"{new_dir_name} already added", "warning")
-                # ra+ and reply+ are reserved for reply-email and reverse-alias
-                elif new_dir_name in ("ra", "reply"):
-                    flash(
-                        f"{new_dir_name} cannot be *ra* and *reply*, please use another name!",
-                        "warning",
-                    )
                 else:
                     new_dir = Directory.create(
                         name=new_dir_name, user_id=current_user.id

+ 3 - 8
email_handler.py

@@ -115,15 +115,10 @@ class MailHandler:
             # try to see if alias could be created on-the-fly
             on_the_fly = False
 
-            # check if alias belongs to a directory. In this case alias has one of the 2 formats:
-            # directory/anything@EMAIL_DOMAIN or directory+anything@EMAIL_DOMAIN
+            # check if alias belongs to a directory, ie having directory/anything@EMAIL_DOMAIN format
             if alias.endswith(EMAIL_DOMAIN):
-                if "+" in alias or "/" in alias:
-                    if "+" in alias:
-                        directory_name = alias[: alias.find("+")]
-                    else:
-                        directory_name = alias[: alias.find("/")]
-
+                if "/" in alias:
+                    directory_name = alias[: alias.find("/")]
                     LOG.d("directory_name %s", directory_name)
 
                     directory = Directory.get_by(name=directory_name)