remove support for directory+anything@EMAIL_DOMAIN

This commit is contained in:
Son NK 2020-01-08 22:09:46 +01:00
parent b8dc368c78
commit ecce1eff99
3 changed files with 3 additions and 15 deletions

View File

@ -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>

View File

@ -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

View File

@ -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)