allow to create reverse alias for NOREPLY

This commit is contained in:
Son 2022-05-20 17:59:41 +02:00
parent 6afe86b395
commit 9ba5464bc9

View file

@ -36,6 +36,7 @@ from app.config import (
MAX_NB_SUBDOMAIN, MAX_NB_SUBDOMAIN,
MAX_NB_DIRECTORY, MAX_NB_DIRECTORY,
ROOT_DIR, ROOT_DIR,
NOREPLY,
) )
from app.db import Session from app.db import Session
from app.errors import ( from app.errors import (
@ -1648,6 +1649,7 @@ class Contact(Base, ModelMixin):
website_email = sanitize_email(website_email) website_email = sanitize_email(website_email)
# make sure contact.website_email isn't a reverse alias # make sure contact.website_email isn't a reverse alias
if website_email != NOREPLY:
orig_contact = Contact.get_by(reply_email=website_email) orig_contact = Contact.get_by(reply_email=website_email)
if orig_contact: if orig_contact:
raise CannotCreateContactForReverseAlias(str(orig_contact)) raise CannotCreateContactForReverseAlias(str(orig_contact))