Merge pull request #901 from simple-login/no-dot-in-reverse-alias
use _ instead of . in reverse alias
This commit is contained in:
commit
9b624edf11
|
@ -1083,7 +1083,9 @@ def generate_reply_email(contact_email: str, user: User) -> str:
|
||||||
contact_email = convert_to_id(contact_email)
|
contact_email = convert_to_id(contact_email)
|
||||||
contact_email = sanitize_email(contact_email)
|
contact_email = sanitize_email(contact_email)
|
||||||
contact_email = contact_email[:45]
|
contact_email = contact_email[:45]
|
||||||
contact_email = contact_email.replace("@", ".at.")
|
# use _ instead of . to avoid AC_FROM_MANY_DOTS SpamAssassin rule
|
||||||
|
contact_email = contact_email.replace("@", "_at_")
|
||||||
|
contact_email = contact_email.replace(".", "_")
|
||||||
contact_email = convert_to_alphanumeric(contact_email)
|
contact_email = convert_to_alphanumeric(contact_email)
|
||||||
|
|
||||||
# not use while to avoid infinite loop
|
# not use while to avoid infinite loop
|
||||||
|
|
|
@ -503,18 +503,21 @@ def test_generate_reply_email_include_sender_in_reverse_alias(flask_client):
|
||||||
user.include_sender_in_reverse_alias = True
|
user.include_sender_in_reverse_alias = True
|
||||||
|
|
||||||
reply_email = generate_reply_email("test@example.org", user)
|
reply_email = generate_reply_email("test@example.org", user)
|
||||||
assert reply_email.startswith("test.at.example.org")
|
assert reply_email.startswith("test_at_example_org")
|
||||||
assert reply_email.endswith(EMAIL_DOMAIN)
|
assert reply_email.endswith(EMAIL_DOMAIN)
|
||||||
|
|
||||||
reply_email = generate_reply_email("", user)
|
reply_email = generate_reply_email("", user)
|
||||||
assert reply_email.endswith(EMAIL_DOMAIN)
|
assert reply_email.endswith(EMAIL_DOMAIN)
|
||||||
|
|
||||||
reply_email = generate_reply_email("👌汉字@example.org", user)
|
reply_email = generate_reply_email("👌汉字@example.org", user)
|
||||||
assert reply_email.startswith("yizi.at.example.org")
|
assert reply_email.startswith("yizi_at_example_org")
|
||||||
|
|
||||||
# make sure reply_email only contain lowercase
|
# make sure reply_email only contain lowercase
|
||||||
reply_email = generate_reply_email("TEST@example.org", user)
|
reply_email = generate_reply_email("TEST@example.org", user)
|
||||||
assert reply_email.startswith("test.at.example.org")
|
assert reply_email.startswith("test_at_example_org")
|
||||||
|
|
||||||
|
reply_email = generate_reply_email("test.dot@example.org", user)
|
||||||
|
assert reply_email.startswith("test_dot_at_example_org")
|
||||||
|
|
||||||
|
|
||||||
def test_normalize_reply_email(flask_client):
|
def test_normalize_reply_email(flask_client):
|
||||||
|
|
Loading…
Reference in a new issue